Quoth "Klaas" <[EMAIL PROTECTED]>:
| A PEP for a mutable bytes type was composed but withdrawn two years
| ago:
...
| Does anyone know if a well-coded and tested implementation of such a
| beast exists now? Strings make me sad.
I didn't look at the PEPs - PEPs always make me sad - but if you
want to just do it, try something like this
import array
class Muto:
def __init__(self, a):
self.data = array.array('c', a)
def __str__(self):
return self.data.tostring()
def __repr__(self):
return repr(self.data.tostring())
def __getitem__(self, i):
return self.data[i]
def __setitem__(self, i, a):
self.data[i] = a
m = Muto('spam')
m[1] = 'h'
print m, [m]
I probably left out a few methods you would want.
Donn Cave, [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list