[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: Peter Hansen <peter () engcorp ! com>
Date: 2005-07-29 11:54:18
Message-ID: u-SdnREzQ9K3h3ffRVn-gg () powergate ! ca
[Download RAW message or body]
Tony Meyer wrote:
> Would you really choose this:
> p = Path() / "build" / "a" / "very" / "very" / "long" / "path"
>
> Over this:
> p = Path(os.path.join("build", "a", "very", "very", "long", "path"))
I'd choose neither, because both are contrived examples (who builds
paths out of six literals like that?) and the second one is not
something anyone would want, since it mixes Paths and old-style
os.path.join() calls.
We're talking at this point about how Path should work, not whether it's
preferable to os.path.join, even though that was really the point of
Reinhard's original post. Given that, then, of the following two I
would prefer the first one, slightly:
p = somePath / user.getFolder() / 'archive' / oldPath + '.bak'
p = somePath.joinpath(user.getFolder(), 'archive', oldPath + '.bak')
> ? A saving of six characters, and the second one is a lot clearer.
It's not a question of saving characters, but readability which, as
you've said, is a matter of opinion.
I find the former more readable. Somewhat. Not enough to make a big
deal about it.
I can live with the latter, but as *someone who has used the path module
already* I can only say that you might want to try it for a few months
before condemning the approach using / as being unacceptable.
-Peter
--
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