__imul__ broken for 'objects' in 2.2.1
kragen at pobox.com
Mon Jun 10 20:52:12 EDT 2002
Alexander Schmolck <a.schmolck at gmx.net> writes:
> I really wonder where this bizzarre behavior comes from -- it is really none
> of the interpreter's business to take guesses whether my class is a sequence
> or not -- finding out if there is a problem with the supplied arguments should
> be left to the discretion of the method itself.
I think it's a bug, but I can easily imagine how it could happen.
At C level, the sequence protocol and the number protocols are
different protocols. They both have slots in their "vtables" that are
invoked by *. Class instances can be either sequences or numbers;
apparently Python is deciding that since instances can be sequences,
it will use the sequence methods (or at least the sequence
implementation of *).
More information about the Python-list