[Python-Dev] The path module PEP

Michael Hoffman hoffman at ebi.ac.uk
Thu Jan 26 10:26:27 CET 2006


[Thomas Wouters]

>> This issue has been brought up before when people were discussing the
>> path module. I think the consensus is that, while the inheritance
>> isn't pure, practicality beats purity. It would require to big changes
>> to Python and would break to much existing code to not extend string.
>
> This is my only problem with the PEP. It's all very nice that subclassing
> from string makes it easier not to break things, but subclassing implies a
> certain relationship.

This is the soul of arguing for purity's sake when practicality would
dictate something else.

If you remove the basestring superclass, then you remove the ability
to use path objects as a drop-in replacement for any path string right
now.  You will either have to use str(pathobj) or carefully check that
the function/framework you are passing the path to does not use
isinstance() or any of the string methods that are now gone.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/1f5bcb67c4c73f15
-- 
Michael Hoffman <hoffman at ebi.ac.uk>
European Bioinformatics Institute



More information about the Python-Dev mailing list