Re: file locking (was Re: fcntl example)
Tue, 17 May 1994 10:10:20 +0200

> Of course, it would be more portable if the marshal.dump() routine just
> required a fileno() method from the second object and use that for its
> output. A change like that would allow posixfile or socket instances
> to be passed in as well. (Guido?)

Alas, if it only were that easy. If you write a file descriptor
corresponding to a stdio file, the stdio file's buffering is messed up
unless you do a fflush first. Since the marshal module also requires
a stdio file (for buffering efficiency), it's better if you pass it
the stdio file that's already there. With sockets you can use the
socket's makefile() method (which returns a stdio file corresponding
to the socket).

Anyway, the real solution will be to allow subclassing from built-in
types. Someday...

--Guido van Rossum, CWI, Amsterdam <>
URL: <>