Dev] / as path join operator (original) (raw)

Stephen J. Turnbull stephen at xemacs.org
Sat Jan 28 07:56:27 CET 2006


"Jason" == Jason Orendorff <jason.orendorff at gmail.com> writes:

Jason> I. Here's an example of the sort of thing you might say if
Jason> you did *not* think of paths as strings:

[...]

Jason> II. And here is the sort of thing you'd say if you thought
Jason> of paths *solely* as strings:

Please note that my point was entirely different from trying to decide whether to subclass strings. My point was precisely that because of this schizophrenia in the use of / as a path join operator in various string representations of paths, it's a bad choice. People are naturally going to write buggy code because they don't have the implemented spec in mind.

Jason> Filesystem paths are in fact strings on all operating
Jason> systems I'm aware of.

I have no idea what you could mean by that. The data structure used to represent a filesystem on all OS filesystems I've used is a graph of directories and files. A filesystem object is located by traversing a path in that graph.

Of course there's a string representation, especially for human use, but manipulating that representation as a string in programs is a regular source of bugs. In most cases, the graph is sufficiently constrained that string manipulations are mostly accurate representations of graph traversal, but not always, and you get defects.

-- School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.



More information about the Python-Dev mailing list