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

Antoine Pitrou solipsis at pitrou.net
Sat Oct 6 14:25:29 CEST 2012


Hello Mark,

On Sat, 06 Oct 2012 11:49:35 +0100
Mark Shannon <mark at hotpy.org> wrote:
> >
> > 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

There is no distinction per "type of file": files, directories, etc.
all share the same implementation. So you only have a per-flavour
distinction (Posix / NT).

> I would prefer duck-typing.
> Add ABCs for all the N types of file and use concrete classes for the 
> actual filesystems

It seems to me that "duck typing" and "ABCs" are mutually exclusive,
kind of :)

> 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?

You mean "would the / operator be better than the [] operator"?

I didn't choose / at first because I knew this choice would be quite
contentious. However, if there happens to be a strong majority in its
favour, why not.

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list