Why doesn't cStringIO.StringIO (<string>) have write methods?

Alex alex at somewhere.round.here
Tue Feb 8 19:18:23 EST 2000


Hi.  I noticed that when cStringIO.StringIO is instantiated with a
string, it doesn't have write methods, but when it's instantiated with
no arguments, it does.  I was curious as to why this is.

Alex.

>>> from cStringIO import StringIO
>>> s = 'TCACCACCACCACCACCATCATCACCACCACCACCATCATCATC'
>>> t = StringIO (s)
>>> from pprint import pprint
>>> pprint (dir (t))
['close',
 'flush',
 'getvalue',
 'isatty',
 'read',
 'readline',
 'reset',
 'seek',
 'tell',
 'truncate']
>>> t = StringIO ()
>>> pprint (dir (t))
['close',
 'flush',
 'getvalue',
 'isatty',
 'read',
 'readline',
 'reset',
 'seek',
 'tell',
 'truncate',
 'write',
 'writelines']
>>> 



More information about the Python-list mailing list