Message357354
> 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. |
|
Date |
User |
Action |
Args |
2019-11-23 01:19:53 | levkivskyi | set | recipients:
+ levkivskyi, brett.cannon, bar.harel |
2019-11-23 01:19:53 | levkivskyi | set | messageid: <1574471993.72.0.222342015059.issue38878@roundup.psfhosted.org> |
2019-11-23 01:19:53 | levkivskyi | link | issue38878 messages |
2019-11-23 01:19:53 | levkivskyi | create | |
|