You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One limitation to promotion is that it won't work for all operations. So
model=Model()
x=model.list(5)
a= [0, 1, 2, 3, 4]
x*a# this will work because we're calling x's __mul__() methoda*x# this will work because first a's __mul__() will fail, so Python will try x's __mul__()x[a] # this will work because we're calling x's __getitem__() methoda[x] # this will not work
Currently, in order to use a scalar/array, you need to cast it to a
Constant
symbol. E.g.with #38 it should be possible to simply do
by promoting
a
to aConstant
inx
's__mul__()
.The main problem is that, in addition to #38, we would probably need some sort of caching. Consider
if each time we see
2
we create a new constant, we end up with 100 identicalConstant
symbols, each encoding the same value of2
. Whereasonly creates one.
The text was updated successfully, but these errors were encountered: