syntactic sugar for def?
ian.g.kelly at gmail.com
Wed Sep 28 23:36:08 CEST 2011
On Wed, Sep 28, 2011 at 3:26 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> I remember that 'class' is sugar for type(....).
> I don't remember if 'def' is sugar for something besides lambda.
> Any clues for me? Heck, I'll even be grateful for outright answers!
If you mean is there a way to create functions using reflection, you
can use types.FunctionType. Like type() requires a dict,
FunctionType() requires a code object that must first be compiled.
More information about the Python-list