Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dict.keys #2023

Merged
merged 6 commits into from
Jul 25, 2023
Merged

Add dict.keys #2023

merged 6 commits into from
Jul 25, 2023

Conversation

kabra1110
Copy link
Collaborator

@kabra1110 kabra1110 commented Jun 25, 2023

Issue: Some extra zeros in list.

from lpython import i32

def test_dict_keys_values():
    d: dict[i32, i32] = {1001:2002, 3003:4004}
    x: list[i32]
    x = d.keys()
    print(x)

test_dict_keys_values()
[0, 1001, 0, 3003, 0]

Copy link
Contributor

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. @kabra1110 is this ready?

@certik
Copy link
Contributor

certik commented Jul 1, 2023

Ah I see, there are some extra zeros.

Make sure to test the result and make it work in both LPython and CPython.

@kabra1110
Copy link
Collaborator Author

kabra1110 commented Jul 8, 2023

Corrected this for linear probing implementation, and added dict.values for the same.

The test in f28eaf0 works with lpython, but not with python, as these functions do not return lists in the latter. I modified them to make copies into lists, but looks like there are some issues with nested iterables.

@kabra1110 kabra1110 marked this pull request as ready for review July 23, 2023 06:39
@czgdp1807 czgdp1807 enabled auto-merge (squash) July 25, 2023 04:56
@czgdp1807 czgdp1807 merged commit 634177d into lcompilers:main Jul 25, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants