-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Open
Labels
enhancementFeature requests, new feature implementationsFeature requests, new feature implementations
Description
have a bit of code that works in Python 3.5 but not micropython:
d = {1:"hello", 2:"world"}
len(d)
len(d.items())
In Py3.5 and 2.7, both len(d)
and len(d.items())
return 2
In micropython, len(d)
is 2 but len(d.items())
throws:
len(d.items())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'dict_view' has no len()
Note that len(d.items()) == len(d.keys()) == len(d.values()) == len(d)
should be true for consistency.
I don't think the version matters but I am running a variant of 1.20.0 on an STM32 L4:
MicroPython 724865b19-dirty on 2023-09-05; NUCLEO-L4A6ZG with STM32L4A6ZG
Type "help()" for more information.
GoToLoop
Metadata
Metadata
Assignees
Labels
enhancementFeature requests, new feature implementationsFeature requests, new feature implementations