parameterized functions: a question of style

Andrew Koenig ark at research.att.com
Mon Aug 12 23:55:38 CEST 2002


Blair> def gen_fn(n):
Blair>     def _fn(x):
Blair>         return x**n

Blair>     return _fn

Why not just write

        def gen_fn(n):
                return lambda x: x**n

?

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark



More information about the Python-list mailing list