Mercurial > cpython-lru_cache-weakref
diff Lib/UserString.py @ 23484:cdd5c751823c legacy-trunk
More --disable-unicode stuff.
I'm getting better at vi!
| author | Michael W. Hudson <mwh@python.net> |
|---|---|
| date | Mon, 20 May 2002 14:48:16 +0000 |
| parents | 8b1268bc371a |
| children | 226ba34bd998 |
line wrap: on
line diff
--- a/Lib/UserString.py Mon May 20 14:30:06 2002 +0000 +++ b/Lib/UserString.py Mon May 20 14:48:16 2002 +0000 @@ -5,14 +5,14 @@ Note: string objects have grown methods in Python 1.6 This module requires Python 1.6 or later. """ -from types import StringType, UnicodeType +from types import StringTypes import sys __all__ = ["UserString","MutableString"] class UserString: def __init__(self, seq): - if isinstance(seq, StringType) or isinstance(seq, UnicodeType): + if isinstance(seq, StringTypes): self.data = seq elif isinstance(seq, UserString): self.data = seq.data[:] @@ -43,19 +43,19 @@ def __add__(self, other): if isinstance(other, UserString): return self.__class__(self.data + other.data) - elif isinstance(other, StringType) or isinstance(other, UnicodeType): + elif isinstance(other, StringTypes): return self.__class__(self.data + other) else: return self.__class__(self.data + str(other)) def __radd__(self, other): - if isinstance(other, StringType) or isinstance(other, UnicodeType): + if isinstance(other, StringTypes): return self.__class__(other + self.data) else: return self.__class__(str(other) + self.data) def __iadd__(self, other): if isinstance(other, UserString): self.data += other.data - elif isinstance(other, StringType) or isinstance(other, UnicodeType): + elif isinstance(other, StringTypes): self.data += other else: self.data += str(other) @@ -159,7 +159,7 @@ start = max(start, 0); end = max(end, 0) if isinstance(sub, UserString): self.data = self.data[:start]+sub.data+self.data[end:] - elif isinstance(sub, StringType) or isinstance(sub, UnicodeType): + elif isinstance(sub, StringTypes): self.data = self.data[:start]+sub+self.data[end:] else: self.data = self.data[:start]+str(sub)+self.data[end:]
