cStringIO module broken by design?

Carsten Gaebler clpy at snakefarm.org
Sun Feb 17 12:44:13 EST 2002


Hi there!

It seems like the cStringIO module doesn't provide a write() method for 
StringIO objects that were initialized with a string:

Python 2.2 (#8, Jan 11 2002, 20:10:20)
[GCC 3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import StringIO
 >>> s = StringIO.StringIO()
 >>> s.write("foobar")
 >>> s = StringIO.StringIO("foo")
 >>> s.write("bar")
 >>>
 >>> import cStringIO
 >>> s = cStringIO.StringIO()
 >>> s.write("foobar")
 >>> s = cStringIO.StringIO("foo")
 >>> s.write("bar")
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
AttributeError: write
 >>>

Why is that? I find it quite annoying.

cg.




More information about the Python-list mailing list