[Checkins]
SVN: zope.file/branches/ajung-blobs/src/zope/file/README.txt
fixed and removed several because the semantics concerning
Andreas Jung
andreas at andreas-jung.com
Mon Feb 26 18:00:33 EST 2007
Log message for revision 72847:
fixed and removed several because the semantics concerning
simultaneous read and writes is somewhat different from
normale files
Changed:
U zope.file/branches/ajung-blobs/src/zope/file/README.txt
-=-
Modified: zope.file/branches/ajung-blobs/src/zope/file/README.txt
===================================================================
--- zope.file/branches/ajung-blobs/src/zope/file/README.txt 2007-02-26 22:52:02 UTC (rev 72846)
+++ zope.file/branches/ajung-blobs/src/zope/file/README.txt 2007-02-26 23:00:33 UTC (rev 72847)
@@ -149,29 +149,13 @@
>>> r.close()
-Using a new reader, we can see how `seek()` can be used to skip
-forward::
- >>> r = f.open("r")
- >>> r.seek(20)
- >>> r.read()
- 'still more'
+Attempting to write to a closed writer raises an exception::
-Now, our writer is still useful, so let's add some more data and make
-sure we can seek into that with our reader. We'll also see that
-closing the writer causes it to flush any buffered data::
- >>> w.write(" woohoo!")
- >>> w.close()
- >>> f.size
- 38
+ >>> w = f.open('w')
+ >>> w.close()
- >>> r.seek(4, 1)
- >>> r.read()
- 'hoo!'
-
-Attempting to write to the closed writer raises an exception::
-
>>> w.write('foobar')
Traceback (most recent call last):
ValueError: I/O operation on closed file
@@ -188,37 +172,3 @@
Traceback (most recent call last):
ValueError: I/O operation on closed file
-The file object also supports the '+' mode--both reading and writing
-simultaneously. This can be convenient for allowing it to be used with
-tools (such as the TIFF PIL plugin as of this writing) with features
-that expect files in this mode.
-
- >>> rw = f.open('r+')
- >>> rw.tell()
- 0L
- >>> rw.read()
- 'some text more text still more woohoo!'
- >>> rw.tell()
- 38
- >>> rw.write(' yippee!')
- >>> rw.seek(31)
- >>> rw.read()
- 'woohoo! yippee!'
- >>> rw.seek(31)
- >>> rw.write('THE END')
- >>> rw.seek(0)
- >>> rw.read()
- 'some text more text still more THE END yippee!'
- >>> rw.close()
- >>> rw = f.open('w+')
- >>> rw.tell()
- 0L
- >>> rw.read()
- ''
- >>> rw.write('hi.')
- >>> rw.tell()
- 3
- >>> rw.seek(0)
- >>> rw.read()
- 'hi.'
- >>> rw.close()
More information about the Checkins
mailing list