tests/cpydiff: Add difference-test for second arg of builtin next().
This commit is contained in:
parent
7cf446f3da
commit
63f47104fe
12
tests/cpydiff/builtin_next_arg2.py
Normal file
12
tests/cpydiff/builtin_next_arg2.py
Normal file
@ -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))
|
Loading…
x
Reference in New Issue
Block a user