[Python-ideas] Structural type checking for PEP 484

Jukka Lehtosalo jlehtosalo at gmail.com
Thu Sep 10 05:40:47 CEST 2015

On Wed, Sep 9, 2015 at 2:16 PM, Sven R. Kunze <srkunze at mail.de> wrote:

> Thanks for sharing, Guido. Some random thoughts:
> - "classes should need to be explicitly marked as protocols"
> If so, why are they classes in the first place? Other languages has
> dedicated keywords like "interface".

I want to preserve compatibility with earlier Python versions (down to
3.2), and this makes it impossible to add any new syntax. Also, there is no
need to add a keyword as there are other existing mechanisms which are good
enough, including base classes (as in the proposal) and class decorators. I
don't think that this will become a very commonly used language feature,
and thus adding special syntax for this doesn't seem very important. My
expectation is that structural subtyping would be primarily useful for
libraries and frameworks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150909/29bc4a71/attachment.html>

More information about the Python-ideas mailing list