[Python-Dev] Re: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.292.10.1, 2.292.10.2

Greg Ewing greg at cosc.canterbury.ac.nz
Sun Oct 26 22:22:26 EST 2003


Alex Martelli <aleaxit at yahoo.com>:

> Exactly the same underlying reason as a bug I just opened on
> SF: if x is an instance of a class X having __mul__ but not
> __rmul__, 3*x works (just like x*3) but 3.0*x raises TypeError

Seems to me the bug there is not giving X an __rmul__
method and yet expecting y*x to work at all. The fact
that it happens to work in some cases is an accident
that should not be relied upon.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list