[Python-checkins] python/dist/src/Lib UserString.py,1.14,1.15
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 08 Aug 2002 18:37:08 -0700
- Previous message: [Python-checkins] python/dist/src/Objects iterobject.c,1.11,1.12 tupleobject.c,2.70,2.71
- Next message: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.22,1.23 test_string.py,1.19,1.20 test_userstring.py,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv31329
Modified Files:
UserString.py
Log Message:
Moved inplace add and multiply methods from UserString to MutableString.
Closes SF Bug #592573 where inplace add mutated a UserString.
Added unittests to verify the bug is cleared.
Index: UserString.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** UserString.py 30 Jul 2002 23:26:00 -0000 1.14
--- UserString.py 9 Aug 2002 01:37:06 -0000 1.15
***************
*** 53,70 ****
else:
return self.__class__(str(other) + self.data)
- def __iadd__(self, other):
- if isinstance(other, UserString):
- self.data += other.data
- elif isinstance(other, StringTypes):
- self.data += other
- else:
- self.data += str(other)
- return self
def __mul__(self, n):
return self.__class__(self.data*n)
__rmul__ = __mul__
- def __imul__(self, n):
- self.data *= n
- return self
# the following methods are defined in alphabetical order:
--- 53,59 ----
***************
*** 169,172 ****
--- 158,172 ----
def immutable(self):
return UserString(self.data)
+ def __iadd__(self, other):
+ if isinstance(other, UserString):
+ self.data += other.data
+ elif isinstance(other, StringTypes):
+ self.data += other
+ else:
+ self.data += str(other)
+ return self
+ def __imul__(self, n):
+ self.data *= n
+ return self
if __name__ == "__main__":
- Previous message: [Python-checkins] python/dist/src/Objects iterobject.c,1.11,1.12 tupleobject.c,2.70,2.71
- Next message: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.22,1.23 test_string.py,1.19,1.20 test_userstring.py,1.8,1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]