[Python-ideas] PEP 428 - object-oriented filesystem paths
Mark Shannon
mark at hotpy.org
Sat Oct 6 15:08:31 CEST 2012
On 06/10/12 13:25, Antoine Pitrou wrote:
>
> 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"?
Actually I did mean the '//' (floor division) operator as it would stand
out more than '/'.
It is just something for you to consider (in case you didn't have enough
possibilities already :) )
>
> 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.
>
>
More information about the Python-ideas
mailing list