[Python-3000] Mini Path object

Jim Jewett jimjjewett at gmail.com
Fri Nov 10 18:37:21 CET 2006


On 11/10/06, Niki Spahiev <niki.spahiev at gmail.com> wrote:
> Greg Ewing wrote:
> > What if you need to know whether it's an absolute or
> > relative path, e.g. so you can join it to another path?
> > You can't do that without knowing something about the
> > semantics.

> Maybe use file: URLs for universal format. They become more and more
> used in internet era.

the file: protocol has a long and messy history; it is now probably
impossible to use in a consistent way without breaking something.  It
works fairly well for the tail of the path, but so does an ordinary
list of path components.

In general practice, even just using a string with a slash in either
direction as the separator will work.  If that has too many corner
cases for your taste, then you should treat "file:" as undefined
behavior.

-jJ


More information about the Python-3000 mailing list