A folder structure is a tree. A graph if you include sylinks. A path is a path in the graph and thas is why it is called a path. It is a set of links. Eack link is identified by its name and its parent. 


From my Android phone on T-Mobile. The first nationwide 4G network.


-------- Original message -------- Subject: Re: [Python-ideas] PEP 428 - object-oriented filesystem paths From: Nick Coghlan To: steve@pearwood.info CC: python-ideas@python.org

On Mon, Oct 8, 2012 at 11:53 PM, Steven D'Aprano <steve@pearwood.info> wrote:
>> "p.subpath('foo', 'bar')" looks like executable
>> pseudocode for creating a new path based on existing one to me,
>
>
> That notation quite possibly goes beyond unintuitive to downright
> perverse. You are using a method called "subpath" to generate a
> *superpath* (deeper, longer path which includes p as a part).

Huh? It's a tree structure. A subpath lives inside its parent path,
just as subnodes are children of their parent node. Agreed it's not a
widely used term though - it's a generalisation of subdirectory to
also cover file paths.

They're certainly not "super" anything, any more than a subdirectory
is really a superdirectory (which is what you appear to be arguing).

> Okay, I'll grant you that we'll probably never get a consensus on
> operators + versus / but I really don't understand why you think that
> p.join is unsuitable for a method which joins path components.

"p.join(r)" has exactly the same problem as "p + r": pass in a string
to a function expecting a path object and you get data corruption
instead of an exception. When you want *different* semantics, then
ducktyping is your enemy and it's necessary to take steps to avoid it,
include changing method names and avoiding some operators.

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas