← index #5046PR #3418
Off-topic · high · value 0.671
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 · PULL REQUEST

RFC: Add _asdict for namedtuple and add some field name checks

closedby stinosopened 2017-11-06updated 2017-12-14

Add the _asdict function when MICROPY_CPYTHON_COMPAT and MICROPY_PY_COLLECTIONS_ORDEREDDICT are both set. While testing this I wondered what would happen in CPython if I'd define a field named '_asdict' and found out no names starting with underscores are allowed. Nor empty names, which makes sense, so I added checks for both.
This is RFC because:

  • could break some existing code which uses namedtuples with field names starting with underscores; on the other hand it doesn't seem worth makeing such an option configurable
  • should the empty name check always be on? It really doesn't make sense using an empty field name
  • there's no API to make an OrderedDict from within the C code so I did it manually but that's a bit dirty, should we have a seperate function for that?

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