__imul__ broken for 'objects' in 2.2.1

Alexander Schmolck a.schmolck at gmx.net
Fri Jun 7 13:17:45 EDT 2002


OK, after unsuccessfully trying for about half an hour to submit this to the
sf bug tracker, I gave up:

class Breaky(object):
    def __imul__(self, other):
        print "imuling"
        return self
sq = Breaky()
sq *=1.

gives:

Traceback (most recent call last):[...] line 10, in ?
    sq *=1.
TypeError: can't multiply sequence to non-int

Unless I'm overlooking something, this is a fairly serious bug and I can't see
a way to work around it (getattribute would presumably work, but slow
everything down unacceptably, so the only 'solution' seems to be to have no
inplace-multiplication).

I had the same behavior on two different machines (running Mandrake 8.2 and
Suse 7.3).

alex



More information about the Python-list mailing list