On Thu, Jun 22, 2017 at 10:44 AM, Markus Wissinger < markus.wissinger@gmail.com> wrote:
Hi,
I have to admit I am not happy with separating the concepts of 'runtime' and 'static' types as implied by pep544.
I am currently exploring a type hint generator that produces hints out of types used in unit tests. It debugs the tests and collects the parameter types of call and return events. It ignores a type when a supertype is present. 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.
proof of concept implementation (writes method docstrings, no pep484 type hints yet): https://github.com/markuswissinger/ducktestpy
This is currently just some personal project that some of you will consider a strange idea.
Not a strange idea, I've had a similar idea and played a bit with it ~10 years ago (inspired by a Java project whose name eludes me now). Also, I think PyCharm is able to do similar things (see https://blog.jetbrains.com/pycharm/2013/02/dynamic-runtime-type-inference-in... ). S. -- Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - http://linkedin.com/in/sfermigier Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/ Chairman, Free&OSS Group / Systematic Cluster - http://www.gt-logiciel-libre.org/ Co-Chairman, National Council for Free & Open Source Software (CNLL) - http://cnll.fr/ Founder & Organiser, PyData Paris - http://pydata.fr/ --- “You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete.” — R. Buckminster Fuller