path module
Just van Rossum
just at xs4all.nl
Tue Jul 8 10:16:11 EDT 2003
Skip Montanaro wrote:
> Just> But when the items are variables, what you read is not what you
> Just> get. Often you'll want (some) literals, and then you get
>
> Just> path = basePath/"a"/"b"/"c"
>
> Just> ...and _that_ I find quite horrible...
>
> I don't know for sure, but I suspect the above could also be
>
> path = basePath/"a/b/c"
Ooh, it _can_ get worse ;-/
Also: this would not be portable on platforms not using / as os.sep, so
is almost equivalent to not using os.path at all and doing
path = basePath + "/a/b/c"
> Still not perfect, but in any case, the '/' is meant to be
> suggestive, not literal. Perhaps you would have preferred he use
> ':'? ;-)
Heh...
> Just> (Did I mention that / usually means divide in Python? ;-)
>
> Sure, just like '%' means modulo in Python, but it seems to have
> found a home in printf-style string expansion.
True, but string expansion is quite old (possibly even Python 0.9 or
1.0?), so most people are used to it. (Although, newbies without a C
background are usually baffled by it. I know I was, back then...).
Just
More information about the Python-list
mailing list