[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    RE: [path-PEP] Path inherits from basestring again
From:       "Delaney, Timothy (Tim)" <tdelaney () avaya ! com>
Date:       2005-08-01 1:52:32
Message-ID: 2773CAC687FD5F4689F526998C7E4E5F0742A3 () au3010avexu1 ! global ! avaya ! com
[Download RAW message or body]

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?

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic