[Python-ideas] Optional static typing -- the crossroads

Łukasz Langa lukasz at langa.pl
Sun Aug 17 17:56:45 CEST 2014


On Aug 17, 2014, at 8:37 AM, Brett Cannon <brett at python.org> wrote:

> On Sun Aug 17 2014 at 6:36:43 AM Andrey Vlasovskikh <andrey.vlasovskikh at gmail.com> wrote:
> There is a problem in static analysis of current types that are instances of abc.ABCMeta or types that just define their own __instancecheck__ / __subclasscheck__. Static analyzers cannot infer in general case what attributes of an instance / subclass do these methods check, because their body can be arbitrarily complex.
> 
> That's only an issue if the type-checking code chooses to care about __instancecheck__/__subclasscheck__. The tool could choose to simply ignore those methods and treat them as a run-time only benefit for isinstance/issubclass checks but not for type checking. This is especially true if the check is being done on the AST instead of imported code. People can simply be told that their linter tool will not pick up magical __instancecheck__/__subclasscheck__ implementations.

+1

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

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


More information about the Python-ideas mailing list