[Python-ideas] URLs/URIs + pathlib.Path + literal syntax = ?

Stephen J. Turnbull stephen at xemacs.org
Wed Mar 30 03:42:34 EDT 2016


Chris Angelico writes:
 > On Wed, Mar 30, 2016 at 3:06 PM, Stephen J. Turnbull <stephen at xemacs.org> wrote:

 > > This means that URIs can be canonicalized syntactically, while doing
 > > so with file system paths is risky.
 > 
 > Or there are two operations: canonicalizing by components, and
 > rendering a "true path", which requires file system access (stat every
 > component).

That's not to my taste because while you do need to make that choice
for filesystem paths, it's always safe (in the sense of "you're buggy,
not me!") to canonicalize a URI.

Also, RFC 3896 explicitly refuses to require URIs to make any physical
sense, while it's an error for a filesystem path to refer to a
non-existent object.  In other words, URIs are abstract syntax to
which you can assign whatever semantics you want (as long as they are
compatible with the syntax), while filesystem paths are actual paths
in a graph that is instantiated in hardware storage.

I suspect you won't have a problem with that distinction, but ISTM
that it's the exact opposite of the way the "let's derive Path from
str" (or from "BaseString" or whatever) crowd want to think
(filesystem paths are a subset of strings).



More information about the Python-ideas mailing list