[SciPy-dev] Suppressing of numpy __mul__, __div__ etc

Dmitrey tmp50@ukr....
Mon Dec 14 05:25:07 CST 2009

I don't think the field name '__do_not_treat_as_scalar__ ' is a good choice. At first, it will be unclear what it is used for, at 2nd, some users / classes, that certainly are not scalars with overloaded __rdiv__ etc sometimes will prefer numpy __div__ method to be used.  
As for me, I would prefer something like '__use_self_operators = True' or '__use_numpy_operations = False' or '__involve_self_overloaded_methods__ = True'.  
I have to release FuncDesigner tomorrow (to keep my quarterly schedule) so please inform me ASAP which name do you finally choose.  
Thank you in advance, D.  
Dag Sverre wrote:  
  FWIW, I'd like to submit a patch to Sage for making NumPy arrays and Sage  
matrices work better together which would require this functionality. +1  
for an attribute and not a mixin, as that would allow Cython classes as  
Something like "__do_not_treat_as_scalar__ = True". The idea is simply to  
stop ndarray from handling the operation, and let other classes implement  
specific support for arithmetic with NumPy arrays. Which is not a slippery  
slope at all.  
Dag Sverre  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20091214/2f1c09c4/attachment.html 

More information about the SciPy-Dev mailing list