[Python-ideas] Structural type checking for PEP 484

Sven R. Kunze srkunze at mail.de
Thu Sep 10 19:07:43 CEST 2015


On 09.09.2015 22:17, Guido van Rossum wrote:
> Jukka wrote up a proposal for structural subtyping. It's pretty good. 
> Please discuss.
>
> https://github.com/ambv/typehinting/issues/11#issuecomment-138133867

*15) How would|Protocol|be implemented?
*"Implement metaclass functionality to detect whether a class is a 
protocol or not. Maybe add a class attribute such as __protocol__ = True 
if that's the case"

If you consider the __protocols__ attribute I mentioned in an earlier 
post, I would like to see __protocol__ renamed to __is_protocol__. I 
think that would make it more readable in the long run.

Best,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150910/f7396d6a/attachment-0001.html>


More information about the Python-ideas mailing list