[Python-Dev] PEP 544: Protocols - second round

Mark Shannon mark at hotpy.org
Thu May 25 13:49:33 EDT 2017


On 24/05/17 14:31, Ivan Levkivskyi wrote:
> Hi all,
>
> After collecting suggestions in the previous discussion on python-dev
> https://mail.python.org/pipermail/python-dev/2017-March/thread.html#147629
> and playing with implementation, here is an updated version of PEP 544.
>
> --
> Ivan

I really like this PEP in general. I think this brings the type system 
for type-hints closer to Python semantics.

But there are a few points I disagree with.
I don't think Protocol types should be tied to ABCs. It just makes 
things more complex with no obvious benefit.
I also think all references to 'isinstance' and 'issubclass' should be 
removed. Type-hints should not have runtime semantics, beyond those that 
they have as classes. In fact, there is no need for protocol types to be 
classes at all.

Cheers,
Mark.



More information about the Python-Dev mailing list