[path-PEP] Path inherits from basestring again
Delaney, Timothy (Tim)
tdelaney at avaya.com
Mon Aug 1 03:52:32 CEST 2005
I have to say, the examples of using / don't really suggest path
concatenation to me.
However, I think the problem is the use of whitespace. Specifically::
path = Path()
subdir = "subdir"
f = "filname"
path = path / subdir / f
looks more like division (even with the obvious names I've used). OTOH:
path = path/subdir/f
*does* look a lot more like path concatenation. So for some people it
may be how it is used.
On the gripping hand, the second example reads more like a regex to me
OK - now for the silly suggestions ... I'm feeling tired ... methinks
Guido would not be happy if I suggested the following on python-dev ;)
For a relative path:
path = ./subdir/f
path = ../subdir/f
For an absolute path:
path = /dir/f
Both of these are currently syntax errors. Introduce the . and .. syntax
which map to calls to Path() and Path(os.path.dirname(os.cwd())
respectively, and the unary division operator (which can either preceed
or follow the object). Hey - paths are special enough to warrant
additional syntax, aren't they?
More information about the Python-list