[Python-ideas] Proposal: Use mypy syntax for function annotations
Antoine Pitrou
antoine at python.org
Mon Aug 25 04:35:49 CEST 2014
Le 24/08/2014 22:16, Chris Angelico a écrit :
> On Mon, Aug 25, 2014 at 12:11 PM, Antoine Pitrou <antoine at python.org> wrote:
>> 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.
>
> "Static method" is a quite different meaning of static - they always
> execute at run-time.
Oh, really, do they?
You missed the entire point. Python's static methods not only execute at
runtime, they are *defined* at runtime. The compiler doesn't know that
something will be a "static method", a regular function, a "class
method"... or whatever. The meaning of "static" is entirely different
from C's or Java's, where the information about static methods is (and
has to be) known at compile time.
Of course, this isn't limited to static methods. The same can be said
about docstrings, which use separate analysis methods in languages such
as C++ or Java (e.g. doxygen, javadoc...), but regular runtime
introspection capabilities in Python.
Regards
Antoine.
More information about the Python-ideas
mailing list