This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author levkivskyi
Recipients bar.harel, brett.cannon, levkivskyi
Date 2019-11-23.01:19:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574471993.72.0.222342015059.issue38878@roundup.psfhosted.org>
In-reply-to
Content
> So why is it bad that in the example class B is considered a "subclass" of os.PathLike by implementing the protocol?

This is not bad, my understanding of the problem is that currently B is considered a subclass of A, while the latter should not be structural.

To give an analogy with PEP 544 (sorry, this is my favourite one :-)) consider this:

class P(Protocol):
    def some(self): ...

class C:
    def some(self): ...

Here C is obviously a "subclass" of P, but:

class Bad(P):  # <- this is _no_ a protocol, just a nominal class
    pass       # explicitly subclassing P

class Good(P, Protocol):  # <- this is a subprotocol that
    pass                  # happened to be identical to P

So here C is a "subclass" of Good, but not a "subclass" of Bad.
History
Date User Action Args
2019-11-23 01:19:53levkivskyisetrecipients: + levkivskyi, brett.cannon, bar.harel
2019-11-23 01:19:53levkivskyisetmessageid: <1574471993.72.0.222342015059.issue38878@roundup.psfhosted.org>
2019-11-23 01:19:53levkivskyilinkissue38878 messages
2019-11-23 01:19:53levkivskyicreate