Python 3.5.2 documents
http://docs.python.jp/3/tutorial/controlflow.html#defining-functions
When you define a function, the function name is included in the current symbol table. The value of the function name has a type that is recognized by the interpreter as a user-defined function. You can assign this value to another name and later use that name as a function. This acts as a general renaming mechanism:
>>> fib
<function fib at 10042ed0>
>>> f = fib
>>> f(100)
0 1 1 2 3 5 8 13 21 34 55 89
fib is defined as f and used. Is it something like an alias? I don't think this was the case with the languages I've experienced so far.
It seems that you can use def
to make the function name easy to understand, and to shorten it for a little processing.
Recommended Posts