> I posted a note to the main list yesterday in response to Dan Connolly's > complaint that the os module isn't very portable. I saw no followups (it's > amazing how fast a thread can die out :-), but I think it's a reasonable > idea, perhaps for Python 2.0, so I'll repeat it here to get some feedback > from people more interesting in long-term Python developments. > > The basic premise is that for each platform on which Python runs there are > portable and nonportable interfaces to the underlying operating system. The > term POSIX has some portability connotations, so let's assume that the posix > module exposes the portable subset of the OS interface. To keep things > simple, let's also assume there are only three supported general OS > platforms: unix, nt and mac. The proposal then is that importing the > platform's module by name will import both the portable and non-portable > interface elements. Importing the posix module will import just that > portion of the interface that is truly portable across all platforms. To > add new functionality to the posix interface it would have to be added to > all three platforms. The posix module will be able to ferret out the > platform it is running on and import the correct OS-independent posix > implementation: > > import sys > _plat = sys.platform > del sys > > if _plat == "mac": from posixmac import * > elif _plat == "nt": from posixnt import * > else: from posixunix import * # some unix variant > > The platform-dependent module would simply import everything it could, e.g.: > > from posixunix import * > from nonposixunix import * > > The os module would vanish or be deprecated with its current behavior > intact. The documentation would be modified so that the posix module > documents the portable interface and the OS-dependent module's documentation > documents the rest and just refers users to the posix module docs for the > portable stuff. > > In theory, this could be done for 1.6, however as I've proposed it, the > semantics of importing the posix module would change. Dan Connolly probably > isn't going to have a problem with that, though I suppose Guido might... If > this idea is good enough for 1.6, perhaps we leave os and posix module > semantics alone and add a module named "portable", "portableos" or > "portableposix" or something equally arcane. And the advantage of this would be...? Basically, it seems you're just renaming the functionality of os to posix. --Guido van Rossum (home page: http://www.python.org/~guido/)
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