circuitpython/tests/cpydiff/builtin_next_arg2.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
309 B
Python
Raw Normal View History

"""
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))