[Python-Dev] import curdir,pardir,sep,pathsep,defpath from relevant *path module
Guido van Rossum
guido@python.org
Thu, 13 Feb 2003 17:41:43 -0500
> It has always mystified me that os.{sep,pathsep} aren't defined in os.path.
Yes, hysterical raisins if I ever saw one. :-)
> Looking at os.py I see that os.{curdir,pardir,defpath} should probably live
> there as well.
Yes.
> Proposal: Move the definitions of curdir, pardir, sep, pathsep and defpath
> into the relevant path module (ntpath, posixpath, etc), then for
> compatibility reimport them ("from path import curdir, pardir, sep, pathsep,
> defpath") later in os.py.
Yes.
> Update the libref documentation to reflect these
> items' new home. Do whatever is necessary deprecation-wise (silent in 2.3?
> Update usage in Python source after 2.3 release and add visible deprecation
> in 2.4?).
No. These things have been where they are for such a long time, there
really is no reason to break everybody's code that uses these.
> Rationale: These variables are all path-related. One of the reasons for
> having platform-specific path modules is to allow programmers to manipulate
> filesystem paths for platform X on platform Y. This would make those items
> available under that sort of scenario. It would also reduce the amount of
> platform-specific code in os.py.
You can document the fact that from now on, posixpath, ntpath, macpath
etc. also have these variables. But don't deprecate the names in os
-- I really don't see the point of that, there's no bug being fixed.
--Guido van Rossum (home page: http://www.python.org/~guido/)