[Python-bugs-list] [ python-Bugs-592573 ] UserString is mutable via +=

noreply@sourceforge.net noreply@sourceforge.net
Thu, 08 Aug 2002 05:48:28 -0700


Bugs item #592573, was opened at 2002-08-08 14:48
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592573&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bernhard Herzog (bernhard)
Assigned to: Nobody/Anonymous (nobody)
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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=592573&group_id=5470