← index #5046Issue #3548
Duplicate · high · value 0.154
QUERY · ISSUE

RFC: MICROPY_PY_BUILTINS_NEXT2 always set to (0) ?

openby pmp-popened 2019-08-27updated 2022-12-22
rfc

Current settings for all ports break cpython script compatibility on next()

https://docs.python.org/3.5/library/functions.html#next

because
MICROPY_PY_BUILTINS_NEXT2 is never defined to 1 except in coverage and defaults to 0
https://github.com/micropython/micropython/blob/master/py/mpconfig.h#L910

CANDIDATE · ISSUE

Built-in functon next() should be able to take a second optional argument.

closedby stroobandtopened 2018-01-04updated 2018-01-31

Quoting https://docs.python.org/3.5/library/functions.html#next

next(iterator[, default])

Retrieve the next item from the iterator by calling its __next__() method. If default is given, it is returned if the iterator is exhausted, otherwise StopIteration is raised.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied