micropython

Annotated tests/lambda_defaults_non_constant.py

400:5c5cddf971cb
2011-02-26 Paul Boddie Added tag feature-universal-__class__-attributes for changeset 83dc777c7083
paul@329 1
#!/usr/bin/env python
paul@329 2
paul@329 3
x = 1
paul@329 4
x = 2
paul@329 5
paul@329 6
def make_add():
paul@329 7
    return lambda a, b=x: a + x
paul@329 8
paul@329 9
def g(f, x):
paul@329 10
    return f(x)
paul@329 11
paul@329 12
add_2 = make_add()
paul@329 13
result_3 = add_2(1)
paul@329 14
result2_3 = g(add_2, 1)
paul@329 15
paul@329 16
# vim: tabstop=4 expandtab shiftwidth=4