> 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 +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4