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

Georg Brandl g.brandl at gmx.net
Sat Oct 6 22:20:27 CEST 2012


Am 06.10.2012 20:59, schrieb Ethan Furman:
> Mike Graham wrote:
>> On Sat, Oct 6, 2012 at 2:39 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
>>> Georg Brandl wrote:
>>>> If you inherit from str, you cannot override any of the operations that
>>>> str already has (i.e. __add__, __getitem__).
>>>
>>> Is this a 3.x thing?  My 2.x version of Path overrides many of the str
>>> methods and works just fine.
>> 
>> This is for theoretical/practical reasons, not technical ones.
> 
> Ah, you mean you can't give them different semantics.  Gotcha.

Yep.  Not much use being able to pass them directly to APIs expecting strings
if they can't operate on them like any other string :)

Georg




More information about the Python-ideas mailing list