[Python-Dev] Placement of os.fdopen functionality (original) (raw)

Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 11 Apr 2003 12:39:53 +1200 (NZST)


If I had to do it over again, your suggestion would make sense;

But having this in the os module, which deals with such low-level file descriptors, still strikes me as a pretty decent place to put it as well, and I don't think it's worth the bother of updating documentation and so on.

I can think of another reason for making it a class method: so that custom subclasses of file, or other file-like objects, can override it to create objects of the appropriate type.

But since it is an os-dependent feature, the implementation of it probably does belong in the os module.

So how about providing a file.fromfd() which calls os.fdopen()?

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+