diff options
Diffstat (limited to 'tests/basics/fun_defargs.py')
-rw-r--r-- | tests/basics/fun_defargs.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/basics/fun_defargs.py b/tests/basics/fun_defargs.py index ed25f5739d..1466c44094 100644 --- a/tests/basics/fun_defargs.py +++ b/tests/basics/fun_defargs.py @@ -1,3 +1,5 @@ +# testing default args to a function + def fun1(val=5): print(val) @@ -18,3 +20,10 @@ try: fun2(1, 2, 3, 4) except TypeError: print("TypeError") + +# lambda as default arg (exposes nested behaviour in compiler) +def f(x=lambda:1): + return x() +print(f()) +print(f(f)) +print(f(lambda:2)) |