Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
MutableString Class Reference
Inheritance diagram for MutableString:
UserString

Public Member Functions

def __init__
 
def __hash__
 
def __setitem__
 
def __delitem__
 
def __setslice__
 
def __delslice__
 
def immutable
 
- Public Member Functions inherited from UserString
def __init__
 
def __str__
 
def __repr__
 
def __int__
 
def __long__
 
def __float__
 
def __complex__
 
def __hash__
 
def __cmp__
 
def __contains__
 
def __len__
 
def __getitem__
 
def __getslice__
 
def __add__
 
def __radd__
 
def __iadd__
 
def __mul__
 
def __imul__
 
def capitalize
 
def center
 
def count
 
def decode
 
def encode
 
def endswith
 
def expandtabs
 
def find
 
def index
 
def isalpha
 
def isalnum
 
def isdecimal
 
def isdigit
 
def islower
 
def isnumeric
 
def isspace
 
def istitle
 
def isupper
 
def join
 
def ljust
 
def lower
 
def lstrip
 
def replace
 
def rfind
 
def rindex
 
def rjust
 
def rstrip
 
def split
 
def splitlines
 
def startswith
 
def strip
 
def swapcase
 
def title
 
def translate
 
def upper
 

Data Fields

 data
 
- Data Fields inherited from UserString
 data
 

Detailed Description

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.

Definition at line 132 of file UserString.py.

Constructor & Destructor Documentation

def __init__ (   self,
  string = "" 
)

Definition at line 147 of file UserString.py.

148  def __init__(self, string=""):
self.data = string

Member Function Documentation

def __delitem__ (   self,
  index 
)

Definition at line 154 of file UserString.py.

References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, _Rlecoderengine.data, Request.data, simple_producer.data, _Environ.data, and FormContentDict.data.

155  def __delitem__(self, index):
156  if index < 0 or index >= len(self.data): raise IndexError
self.data = self.data[:index] + self.data[index+1:]
def __delslice__ (   self,
  start,
  end 
)

Definition at line 165 of file UserString.py.

References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, _Rlecoderengine.data, Request.data, simple_producer.data, _Environ.data, FormContentDict.data, and sre_parse.max.

166  def __delslice__(self, start, end):
167  start = max(start, 0); end = max(end, 0)
self.data = self.data[:start] + self.data[end:]
def __hash__ (   self)

Definition at line 149 of file UserString.py.

150  def __hash__(self):
raise TypeError, "unhashable type (it is mutable)"
def __setitem__ (   self,
  index,
  sub 
)

Definition at line 151 of file UserString.py.

References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, _Rlecoderengine.data, Request.data, simple_producer.data, _Environ.data, and FormContentDict.data.

152  def __setitem__(self, index, sub):
153  if index < 0 or index >= len(self.data): raise IndexError
self.data = self.data[:index] + sub + self.data[index+1:]
def __setslice__ (   self,
  start,
  end,
  sub 
)

Definition at line 157 of file UserString.py.

References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, _Rlecoderengine.data, Request.data, simple_producer.data, _Environ.data, FormContentDict.data, sre_parse.max, and locale.str().

158  def __setslice__(self, start, end, sub):
159  start = max(start, 0); end = max(end, 0)
160  if isinstance(sub, UserString):
161  self.data = self.data[:start]+sub.data+self.data[end:]
162  elif isinstance(sub, StringType) or isinstance(sub, UnicodeType):
163  self.data = self.data[:start]+sub+self.data[end:]
164  else:
self.data = self.data[:start]+str(sub)+self.data[end:]
def immutable (   self)

Definition at line 168 of file UserString.py.

References UserDict.data, UserList.data, UserString.data, _localized_month.data, _localized_day.data, SubPattern.data, _Hqxcoderengine.data, _Rlecoderengine.data, Request.data, simple_producer.data, _Environ.data, and FormContentDict.data.

169  def immutable(self):
170  return UserString(self.data)

Field Documentation

data

Definition at line 148 of file UserString.py.


The documentation for this class was generated from the following file: