[Python-ideas] Better stdlib support for Path objects

MRAB python at mrabarnett.plus.com
Tue Oct 7 01:52:55 CEST 2014


On 2014-10-07 00:40, Alexander Belopolsky wrote:
>
> On Mon, Oct 6, 2014 at 7:26 PM, Juancarlo Añez <apalala at gmail.com
> <mailto:apalala at gmail.com>> wrote:
>
>     What do you think would be the nastier impacts of making
>     pathlib.Path inherit from str?
>
>
> Duplication of storage.  Currently, pathlib.Path objects store a list of
> path components.  To inherit meaningfully from str, they would have to
> store joined path string as well.
>
Wouldn't it also mean that it would inherit str's methods, but they
would return instances of path, and it would need to determine the new
path components?


More information about the Python-ideas mailing list