Skip to content

Commit 63f4710

Browse files
committed
tests/cpydiff: Add difference-test for second arg of builtin next().
1 parent 7cf446f commit 63f4710

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/cpydiff/builtin_next_arg2.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
categories: Modules,builtins
3+
description: Second argument to next() is not implemented
4+
cause: MicroPython is optimised for code space.
5+
workaround: Instead of `val = next(it, deflt)` use::
6+
7+
try:
8+
val = next(it)
9+
except StopIteration:
10+
val = deflt
11+
"""
12+
print(next(iter(range(0)), 42))

0 commit comments

Comments
 (0)