[Python-Dev] Re: the "3*x works w/o __rmul__" bug

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Oct 28 19:34:11 EST 2003


Guido van Rossum <guido at python.org>:

> The reason why it works at all for integers without __rmul__ is
> complicated; it has to do with very tricky issues in trying to
> implement multiplication of a sequence with an integer.

I thought the plan was to get rid of all the special case code in the
interpreter for multiplying sequences and push it all down into
methods of the objects concerned, i.e. all sequences, including the
built-in ones, would implement the C equivalent of both __mul__ and
__rmul__ if they wanted to support multiplication on both sides.

Is there some reason why that wouldn't work? Or is it just that
nobody has had time to fix all the built-in sequences to work
this way?

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