QUERY · ISSUE
RFC: MICROPY_PY_BUILTINS_NEXT2 always set to (0) ?
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
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?