summaryrefslogtreecommitdiffstatshomepage
path: root/tests/cpydiff/builtin_next_arg2.py
blob: 5df2d6e70f83752f3a2d88788f371c315d799dcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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))