[Python-ideas] Proposal: Use mypy syntax for function annotations

Antoine Pitrou antoine at python.org
Mon Aug 25 04:11:07 CEST 2014


Le 24/08/2014 21:30, Steven D'Aprano a écrit :
>>
>> In your idea of "static analysis", it hasn't. Because you think it
>> should involve some kind of separate syntax analysis tool that has
>> nothing to do with regular Python.
>
> That's not "my" idea of static analysis, that is the standard definition
> of "static" as happening at compile-time. If it happens at runtime, it's
> not static

No, that's the standard definition of "static" in a certain category of 
languages such as C. Python has "static methods" and they don't happen 
at compile-time: "staticmethod" is a regular callable which is invoked 
at runtime.

And there are other precedents, such as RPython which is also 
"statically" typed but... using code loaded from imported modules (in 
other words, I'm not inventing anything new here).

> This proposal isn't just about the Python interpreter, its also about
> static tools like linters, IDEs and editors.

Those so-called "static" tools are free to invoke the interpreter and 
use Python's *runtime* introspection facilities. And I'm sure some of 
them do.

Really, it's amusing that I tried several times to explain you that 
"static" analysis didn't need to happen in an entirely separate 
evaluation context, and you still don't get it. You speak like some C 
programmer who has newly discovered Python and doesn't realize the 
magnitude of the differences between the two languages.

Therefore I think the word "static" should be banned from this entire 
discussion, otherwise folks like you will keep associating irrelevant 
concepts with it.

Regards

Antoine.




More information about the Python-ideas mailing list