[Python-3000] PEP 3116 question
lists at cheimes.de
Thu Jan 10 04:45:29 CET 2008
>>From PEP 3116: "BufferedRandom implementation is for all random-access
> objects, whether they are read-only, write-only, or *read-write*."
> (emphasis mine) However, from the pseudo-code for open(),
> "if reading + writing + appending > 1:
> raise ValueError("can't have read/write/append mode at once")"
> dosn't this contradict each other? Why isn't read + write allowed when
> BufferedRandom does allow it? Java's RandomAccessFile allows the mode
> "rw". Is there a way to do something like it in Python?
In Python we have "r+" or "w+". r+ opens a file for reading but also
allows writing. w+ creates or truncates a file and allows reading and
writing. In the open function it's called "updating".
More information about the Python-3000