path module

Skip Montanaro skip at pobox.com
Tue Jul 8 16:51:26 CEST 2003


    >> path = basePath/"a/b/c"

    Just> Ooh, it _can_ get worse ;-/

    Just> Also: this would not be portable on platforms not using / as
    Just> os.sep, ...

Not necessarily.  My guess (again, without trying it) is that it does the
right thing.  Right near the top of

    http://www.jorendorff.com/articles/python/path/

Jason writes:

    I like for my code to be cross-platform, but I tired of typing
    os.path.join in about 1994.



    >> Sure, just like '%' means modulo in Python, but it seems to have
    >> found a home in printf-style string expansion.

    Just> True, but string expansion is quite old (possibly even Python 0.9
    Just> or 1.0?), so most people are used to it. (Although, newbies
    Just> without a C background are usually baffled by it. I know I was,
    Just> back then...).

Just because a better alternative to os.path turns up now is no reason to
discount it.

Nonetheless, before anything like Jason's path module is incorporated into
the standard distribution, a PEP is almost certainly required.  I imagine
there are some things which could be done better (or at least differently)
to make the overall module more acceptable.

Skip





More information about the Python-list mailing list