You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enhance Data Structures : Support for in iteration of dict #1881
def f():
d:dict[i32,i32] = {1 : 100,2 : 200,3 : 300,4 : 400}
i:i32
for i in d: # for in works with string, list, tuple, set
print(i)
f()
(lp) C:\Users\kunni\lpython>python try.py
1
2
3
4
changed the title [-]Enhance Data Structures: Support for iteration of `dict`[/-][+]Enhance Data Structures : Support `for in` iteration of `dict`[/+]on Jun 7, 2023
Activity
[-]Enhance Data Structures: Support for iteration of `dict`[/-][+]Enhance Data Structures : Support `for in` iteration of `dict`[/+]czgdp1807 commentedon Jun 24, 2023
First we have to implement
dict.keysanddict.values(1 PR). And then we can implementfor infordict(and then a separate PR).kabra1110 commentedon Jun 25, 2023
Should
dict.keysbe alist? CPython uses view objects, which do not support manylistoperations.czgdp1807 commentedon Jun 25, 2023
That’s true. For now let’s keep it as a list. Later if needed we can create a separate type for
dict.keys.