diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-30 21:21:24 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-30 21:21:24 +0100 |
commit | 230fec77d7bd9bae5e86a009d549550d6047fd07 (patch) | |
tree | 2620e7898155d2973153fba69cab5aab0ace54d0 /tests/basics/fun-calldblstar.py | |
parent | f6a820903afe12760b27553831c3bdb16c50b985 (diff) | |
download | micropython-230fec77d7bd9bae5e86a009d549550d6047fd07.tar.gz micropython-230fec77d7bd9bae5e86a009d549550d6047fd07.zip |
py: Implement positional and keyword args via * and **.
Extends previous implementation with * for function calls to * and **
for both function and method calls.
Diffstat (limited to 'tests/basics/fun-calldblstar.py')
-rw-r--r-- | tests/basics/fun-calldblstar.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/basics/fun-calldblstar.py b/tests/basics/fun-calldblstar.py new file mode 100644 index 0000000000..aae9828cf7 --- /dev/null +++ b/tests/basics/fun-calldblstar.py @@ -0,0 +1,17 @@ +# test calling a function with keywords given by **dict + +def f(a, b): + print(a, b) + +f(1, **{'b':2}) +f(1, **{'b':val for val in range(1)}) + +# test calling a method with keywords given by **dict + +class A: + def f(self, a, b): + print(a, b) + +a = A() +a.f(1, **{'b':2}) +a.f(1, **{'b':val for val in range(1)}) |