| | |
- UserString
-
- MutableString
class MutableString(UserString) |
| |
mutable string objects
Python strings are immutable objects. This has the advantage, that
strings may be used as dictionary keys. If this property isn't needed
and you insist on changing string values in place instead, you may cheat
and use MutableString.
But the purpose of this class is an educational one: to prevent
people from inventing their own mutable string class derived
from UserString and than forget thereby to remove (override) the
__hash__ method inherited from UserString. This would lead to
errors that would be very hard to track down.
A faster and better solution is to rewrite your program using lists. |
| |
Methods defined here:
- __delitem__(self, index)
- __delslice__(self, start, end)
- __hash__(self)
- __iadd__(self, other)
- __imul__(self, n)
- __init__(self, string='')
- __setitem__(self, index, sub)
- __setslice__(self, start, end, sub)
- immutable(self)
Methods inherited from UserString:
- __add__(self, other)
- __cmp__(self, string)
- __complex__(self)
- __contains__(self, char)
- __float__(self)
- __getitem__(self, index)
- __getslice__(self, start, end)
- __int__(self)
- __len__(self)
- __long__(self)
- __mod__(self, args)
- __mul__(self, n)
- __radd__(self, other)
- __repr__(self)
- __rmul__ = __mul__(self, n)
- __str__(self)
- capitalize(self)
- # the following methods are defined in alphabetical order:
- center(self, width, *args)
- count(self, sub, start=0, end=2147483647)
- decode(self, encoding=None, errors=None)
- encode(self, encoding=None, errors=None)
- endswith(self, suffix, start=0, end=2147483647)
- expandtabs(self, tabsize=8)
- find(self, sub, start=0, end=2147483647)
- index(self, sub, start=0, end=2147483647)
- isalnum(self)
- isalpha(self)
- isdecimal(self)
- isdigit(self)
- islower(self)
- isnumeric(self)
- isspace(self)
- istitle(self)
- isupper(self)
- join(self, seq)
- ljust(self, width, *args)
- lower(self)
- lstrip(self, chars=None)
- partition(self, sep)
- replace(self, old, new, maxsplit=-1)
- rfind(self, sub, start=0, end=2147483647)
- rindex(self, sub, start=0, end=2147483647)
- rjust(self, width, *args)
- rpartition(self, sep)
- rsplit(self, sep=None, maxsplit=-1)
- rstrip(self, chars=None)
- split(self, sep=None, maxsplit=-1)
- splitlines(self, keepends=0)
- startswith(self, prefix, start=0, end=2147483647)
- strip(self, chars=None)
- swapcase(self)
- title(self)
- translate(self, *args)
- upper(self)
- zfill(self, width)
|
class UserString |
| | |
Methods defined here:
- __add__(self, other)
- __cmp__(self, string)
- __complex__(self)
- __contains__(self, char)
- __float__(self)
- __getitem__(self, index)
- __getslice__(self, start, end)
- __hash__(self)
- __init__(self, seq)
- __int__(self)
- __len__(self)
- __long__(self)
- __mod__(self, args)
- __mul__(self, n)
- __radd__(self, other)
- __repr__(self)
- __rmul__ = __mul__(self, n)
- __str__(self)
- capitalize(self)
- # the following methods are defined in alphabetical order:
- center(self, width, *args)
- count(self, sub, start=0, end=2147483647)
- decode(self, encoding=None, errors=None)
- encode(self, encoding=None, errors=None)
- endswith(self, suffix, start=0, end=2147483647)
- expandtabs(self, tabsize=8)
- find(self, sub, start=0, end=2147483647)
- index(self, sub, start=0, end=2147483647)
- isalnum(self)
- isalpha(self)
- isdecimal(self)
- isdigit(self)
- islower(self)
- isnumeric(self)
- isspace(self)
- istitle(self)
- isupper(self)
- join(self, seq)
- ljust(self, width, *args)
- lower(self)
- lstrip(self, chars=None)
- partition(self, sep)
- replace(self, old, new, maxsplit=-1)
- rfind(self, sub, start=0, end=2147483647)
- rindex(self, sub, start=0, end=2147483647)
- rjust(self, width, *args)
- rpartition(self, sep)
- rsplit(self, sep=None, maxsplit=-1)
- rstrip(self, chars=None)
- split(self, sep=None, maxsplit=-1)
- splitlines(self, keepends=0)
- startswith(self, prefix, start=0, end=2147483647)
- strip(self, chars=None)
- swapcase(self)
- title(self)
- translate(self, *args)
- upper(self)
- zfill(self, width)
| |