Getting a set of lambda functions

Martin Manns mmanns at gmx.net
Sun May 25 08:34:34 EDT 2008


On Sun, 25 May 2008 12:14:25 +0000 (UTC)
Ivan Illarionov <ivan.illarionov at gmail.com> wrote:

> On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote:
> 
> Maybe make a set of code objects?
> 
> func_code_set = set([f.func_code for f in funclist])
> 
> funclist = []
> for fc in func_code_set:
>     f = lambda x: x
>     f.func_code = fc
>     funclist.append(f)

Works for me.

Thanks

Martin



More information about the Python-list mailing list