|
|
|
|
|
by shiandow
434 days ago
|
|
That is amazing. My main doubt would be how future proof this is. Does it wrap numpy? Or something equivalent? Does it require continuous development to keep up? Also I both understand the need for declaring the matrices up front and think it's a bit of a shame that it is not seamless. Here are some (ill-advised?) alternatives: X, Y, Z = dp.Slots()
with dp.Slot() as X:
...
import dp.Slot as new
X = new['i','j'] = ...
X = dp['i','j'] = ...
|
|
I like your alternatives! I agree that having to write
before assigning to X is unfortunate. I settled on the current syntax mostly just because I thought it was the choice that made it most "obvious" what was happening under the hood. If you really want to, you could use the walrus operator and write but this cure seems worse than the disease...Actually, doing something like
could simplify the implementation. Currently, a Slot has to act both like an Array and a Slot, which is slightly awkward. If new is a special object, it could just return an Array, which would be a bit nicer.