micropython

Annotated tests/call_func_default_redefine.py

400:5c5cddf971cb
2011-02-26 Paul Boddie Added tag feature-universal-__class__-attributes for changeset 83dc777c7083
paul@189 1
#!/usr/bin/env python
paul@189 2
paul@189 3
def f(a, b, c=4):
paul@190 4
    return c
paul@189 5
paul@189 6
g = f
paul@229 7
paul@229 8
result_3 = g(1, c=3, b=2) # f(c=3) -> 3
paul@229 9
result_4 = g(1, 2)        # f(c=4) -> 4
paul@189 10
paul@189 11
def g(a, c, b=5):
paul@190 12
    return b
paul@189 13
paul@229 14
result_2 = g(1, c=3, b=2) # g(b=2) -> 2
paul@229 15
result_5 = g(1, 3)        # g(b=5) -> 5
paul@189 16
paul@189 17
# vim: tabstop=4 expandtab shiftwidth=4