[Python-bugs-list] [ python-Bugs-592573 ] UserString is mutable via +=
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 08 Aug 2002 18:09:35 -0700
Bugs item #592573, was opened at 2002-08-08 07:48
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592573&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Bernhard Herzog (bernhard)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: UserString is mutable via +=
Initial Comment:
UserString is mutable with augmented assignment:
Python 2.2 (#1, Jan 17 2002, 21:04:07)
[GCC 2.95.4 20011006 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import UserString
>>> s = t = UserString.UserString("abc")
>>> s += "def"
>>> s
'abcdef'
>>> t
'abcdef'
>>>
The __iadd__ and __imul__ methods should be in the
MutableString class I think.
OTOH, nowadays the string types can be sub-classed so
that UserString behaving exactly like a builtin string
may not be that important anymore.
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-08-08 20:09
Message:
Logged In: YES
user_id=80475
Patch and unittest attached for review.
Possible 2.2 release-maint candidate.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2002-08-08 12:51
Message:
Logged In: YES
user_id=80475
Thanks for the bug report.
Will patch to bring behavior back in-line with string
methods as promised by the docs.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592573&group_id=5470