On Dec 29, 2007 3:00 PM, Bruce Sherwood <Bruce_Sherwood@ncsu.edu> wrote:
Thanks to those who made suggestions. There remains the question of why operator overloading of the kind I've described worked with Numeric and Boost but not with numpy and Boost. There is also the question of whether it would pay for numpy to make what is probably an exceedingly fast check and do much faster calculations of sqrt(scalar) and other such mathematical functions.
I think the problem you ran into with Numeric has to do with Python's optimizations for built-ins. In order to override members of e.g. class "dict," you have to provide a trivial subclass (or do something funny with a metaclass) because, I think, otherwise Python hard-wires method calls to the extension method instead of looking them up in __dict__. That's about all I know on the subject, unfortunately, but here's Guido on this issue: http://mail.python.org/pipermail/python-dev/2003-November/040070.html -Max -- "The presentation or 'gift' of the Holy Ghost simply confers upon a man the right to receive at any time, when he is worthy of it and desires it, the power and light of truth of the Holy Ghost, although he may often be left to his own spirit and judgment." --Joseph F. Smith (manual, p. 69) Be pretty if you are, Be witty if you can, But be cheerful if it kills you.