[Numpy-discussion] Possible new multiplication operators for Python

Robert Kern robert.kern@gmail....
Sun Aug 17 17:59:15 CDT 2008


On Sun, Aug 17, 2008 at 17:00, Ondrej Certik <ondrej@certik.cz> wrote:
> There is some inconsistency though, for example one can override A() +
> A(), but one cannot override 1 + 1. This could (should) be fixed
> somehow.

This is getting off-topic, but I really hope that never changes. The
difference between A.__add__ and int.__add__ is that you are defining
A. Python defines int. If you mess with fundamental types like that,
you will break other libraries and must confine yourself to just code
that you've written.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the Numpy-discussion mailing list