__imul__ broken for 'objects' in 2.2.1

Michael Hudson mwh at python.net
Sat Jun 8 12:50:36 EDT 2002


Alexander Schmolck <a.schmolck at gmx.net> writes:

> 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).

Hmm.  You should file a bug on sf so this doesn't get forgotten
(unless it's already been reported, but I don't think so).

Cheers,
M.

-- 
  It's a measure of how much I love Python that I moved to VA, where
  if things don't work out Guido will buy a plantation and put us to
  work harvesting peanuts instead.     -- Tim Peters, comp.lang.python



More information about the Python-list mailing list