micropython

tests/lambda.py

214:398f466a7011
2009-05-16 Paul Boddie Added notes about star parameter handling approaches. Made minor documentation/comment fixes.
     1 #!/usr/bin/env python     2      3 identity = lambda x: x     4 add_2 = lambda a, b=2: a + b     5      6 def f(c):     7     return lambda a, b=c: a + b     8      9 def g(f, x):    10     return f(x)    11     12 identity(1)    13 add_2(1)    14 g(identity, 1)    15 g(add_2, 1)    16 g(f(3), 1)    17     18 # vim: tabstop=4 expandtab shiftwidth=4