[issue30957] pathlib: Path and PurePath cannot be subclassed

2017-07-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of issue24132. -- nosy: +serhiy.storchaka resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Direct sub-classing of pathlib.Path ___ Python tracker

[issue30957] pathlib: Path and PurePath cannot be subclassed

2017-07-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 3.4, 3.5 and 3.6 are in feature-freeze, so this enhancement can only apply to 3.7. You say that pathlib.Path "can't be subclassed", but then immediately show an example of subclassing it: >>> class MyPath(pathlib.Path): ... pass ... Which works fi

[issue30957] pathlib: Path and PurePath cannot be subclassed

2017-07-17 Thread Simon Bernier St-Pierre
New submission from Simon Bernier St-Pierre: Because of the special way Path and PurePath are instantiated, they can't be inherited like a normal class. Here's an example of the issue: >>> import pathlib >>> class MyPath(pathlib.Path): ... pass ... >>> p = MyPath('/home') Traceback (most rec