[Python-Dev] PEP 544: Protocols - second round
Ivan Levkivskyi
levkivskyi at gmail.com
Thu Jun 22 17:53:20 EDT 2017
More information about the Python-Dev mailing list
Thu Jun 22 17:53:20 EDT 2017
- Previous message (by thread): [Python-Dev] PEP 544: Protocols - second round
- Next message (by thread): [Python-Dev] PEP 544: Protocols - second round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 22 June 2017 at 10:44, Markus Wissinger <markus.wissinger at gmail.com> wrote: > I have to admit I am not happy with separating the concepts of 'runtime' > and 'static' types as implied by pep544. > This is not something new, already PEP 483 makes a clear distinction between types (a static concept) and classes (a runtime concept). > Failing isinstance/issubclass calls for protocols would hurt there. I > understand that any type checker code that could provide isinstance > functionality for pep544 protocols would rely on method signatures that my > hint generator is just producing. > isinstance(obj, T) and issubclass(Cls, T) already fail if T is a subscripted generic like List[int], so that again nothing new here. To check runtime subtyping with such types one can write a third party introspection tool based on typing_inspect package on PyPI (which potentially might in future become an official wrapper for currently internal typing API). -- Ivan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170622/b0c9d70a/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 544: Protocols - second round
- Next message (by thread): [Python-Dev] PEP 544: Protocols - second round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list