[issue38878] os.PathLike subclasshook causes subclass checks true on abstract implementation

Brett Cannon report at bugs.python.org
Fri Nov 22 18:38:20 EST 2019


Brett Cannon <brett at python.org> added the comment:

I just realized one problem with this is it explicitly requires subclassing the ABC while os.PathLike is supposed to represent a protocol (before typing.Protocol was a thing).

So why is it bad that in the example class B is considered a "subclass" of os.PathLike by implementing the protocol? Since it implements the expected protocol what exactly is being lost by not checking for an explicit registration or subclass?

----------
nosy: +levkivskyi

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38878>
_______________________________________


More information about the Python-bugs-list mailing list