syntactic sugar for def?
Ian Kelly
ian.g.kelly at gmail.com
Wed Sep 28 17:36:08 EDT 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.
Cheers,
Ian
More information about the Python-list
mailing list