lambdas vs functions: a bytecode question

Fernando Perez fperez528 at yahoo.com
Fri Dec 17 20:28:57 EST 2004


Erik Max Francis wrote:

> Fernando Perez wrote:
> 
>> Can someone explain to me what the extra two bytecodes at the end of the
>> function version (ff) are for?
>> 
>> This is just curiosity, please note that I am NOT making any arguments pro
>> or against lambdas, functions or anything else.
> 
> It's returning None.  I would guess that it's a safety net to make sure
> you don't fall of the end of the function without returning anything;
> that is, the code analysis is not in place to see whether it's necessary
> to actually include in the bytecodes or not.

Thanks, that makes sense, considering that the bytecode compiler in python does
very little in the way of flow analysis.

Regards,

f




More information about the Python-list mailing list