micropython

tests/lambda_defaults_non_constant.py

519:814bd122d84d
2012-06-04 Paul Boddie Updated the documentation to reflect class attribute assignment policies. Added tests to demonstrate class attribute rebinding.
     1 #!/usr/bin/env python     2      3 x = 1     4 x = 2     5      6 def make_add():     7     return lambda a, b=x: a + x     8      9 def g(f, x):    10     return f(x)    11     12 add_2 = make_add()    13 result_3 = add_2(1)    14 result2_3 = g(add_2, 1)    15     16 # vim: tabstop=4 expandtab shiftwidth=4