[Python-ideas] PEP 428 - object-oriented filesystem paths

Mark Shannon mark at hotpy.org
Sat Oct 6 12:49:35 CEST 2012


Just to add my 2p's worth.

On 05/10/12 19:25, Antoine Pitrou wrote:
>
> Hello,
>
> This PEP is a resurrection of the idea of having object-oriented
> filesystem paths in the stdlib. It comes with a general API proposal
> as well as a specific implementation (*). The implementation is young
> and discussion is quite open.
>
> (*) http://pypi.python.org/pypi/pathlib/
>
> Regards
>
> Antoine.
>
> PS: You can all admire my ASCII-art skills.
>

In general I like it.

>
> Class hierarchy
> ---------------

Lovely ASCII art work :)
but it does have have the n*m problem of such hierarchies.
N types of file:
file, directory, mount-point, drive, root, etc, etc
and M implementations
Posix, NT, linux, OSX, network, database, etc, etc

I would prefer duck-typing.
Add ABCs for all the N types of file and use concrete classes for the 
actual filesystems
That way there are N+M rather than N*M classes.

Although I'm generally against operator overloading, would the // 
operator be better than  the // operator as it is more rarely used and 
more visually distinctive?

Cheers,
Mark.





More information about the Python-ideas mailing list