diff options
author | Damien George <damien.p.george@gmail.com> | 2017-11-28 10:50:53 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-11-28 10:50:53 +1100 |
commit | 63f47104feec03cd529b80c654a2aa80e3e7d524 (patch) | |
tree | c1e1b40bc858b9ec015b8db96794bd4e25e323d7 | |
parent | 7cf446f3daa820b15f0027d3468f1b78be17fec7 (diff) |
tests/cpydiff: Add difference-test for second arg of builtin next().
-rw-r--r-- | tests/cpydiff/builtin_next_arg2.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/cpydiff/builtin_next_arg2.py b/tests/cpydiff/builtin_next_arg2.py new file mode 100644 index 000000000..cbde773f9 --- /dev/null +++ b/tests/cpydiff/builtin_next_arg2.py @@ -0,0 +1,12 @@ +""" +categories: Modules,builtins +description: Second argument to next() is not implemented +cause: MicroPython is optimised for code space. +workaround: Instead of `val = next(it, deflt)` use:: + + try: + val = next(it) + except StopIteration: + val = deflt +""" +print(next(iter(range(0)), 42)) |