[Python-ideas] Before and after the colon in funciton defs.

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 20 07:44:10 CEST 2011

Ron Adam wrote:

> I guess the real *special* magic is the byte code, CALL_FUNCTION, which
> knows how to use a function object.  Along with the other Function
> related bytecodes.

I'd say it's more in the function object's __call__ method,
which invokes the C code that knows how to interpret bytecodes.
The CALL_FUNCTION bytecode just calls the __call__method of the
object being called, whatever it happens to be.

The function object's __get__ method also plays a part when
a method call is involved, as does the __getattribute__ method
of the type object. The magic tends to be spread around a fair
bit in Python.


More information about the Python-ideas mailing list