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

Guido van Rossum guido at python.org
Tue Oct 28 19:37:38 EST 2003

> 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?

It would be a lot of work, and I expect that for 3rd party extension
types (and possibly for 3rd party Python classse) it wouldn't be quite
compatible.  I want it to work this way in Python 3.0, but I don't
know if it's worth reworking all that tedious detail in the 2.x

(Understanding that 3.0 is a few years away still.)

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list