[Python-bugs-list] [ python-Bugs-459188 ] unicode.__imul__ etc. missing
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 06 Sep 2001 08:13:37 -0700
Bugs item #459188, was opened at 2001-09-06 07:38
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459188&group_id=5470
Category: Type/class unification
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Guido van Rossum (gvanrossum)
Summary: unicode.__imul__ etc. missing
Initial Comment:
The str and the unicode type are missing all the
__i*__ methods in 2.2a2:
>>> s = u"foo"
>>> s*=5
>>> s
u'foofoofoofoofoo'
>>> s.__imul__(5)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'unicode' object has no
attribute '__imul__'
>>> s+="bar"
>>> s
u'foofoofoofoofoobar'
>>> s.__iadd__("bar")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'unicode' object has no
attribute '__iadd__'
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-06 08:13
Message:
Logged In: YES
user_id=6380
This is not a bug. These (immutable) types don't implement
those operations, and then the system falls back to
implementing x+=y as x=x+y.
If you define a regular class without __iadd__ etc., += is
implemented in the same way.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459188&group_id=5470