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

[DICT] Add Python support for popitem #1887

Open
Tracked by #1570
EmilyBourne opened this issue May 16, 2024 · 5 comments
Open
Tracked by #1570

[DICT] Add Python support for popitem #1887

EmilyBourne opened this issue May 16, 2024 · 5 comments
Assignees

Comments

@EmilyBourne
Copy link
Member

Describe the feature

Syntactic and semantic support should be added for popitem. This should be tested by implementing Python printing

Test Code

Provide code which does not currently work but which should do when this issue is fixed:

def foo():
    a = {1,1.0, 2:2.0}
    b = a.popitem()
    c = a.popitem()
    return a, b, c
@shoaib-moeen
Copy link

@EmilyBourne . Could you give me a little insight on this?

@shoaib-moeen
Copy link

@EmilyBourne I am going to fork the devel-issue1886 branch which already have the pop() method implemented to avoid any conflicts

@EmilyBourne
Copy link
Member Author

@EmilyBourne . Could you give me a little insight on this?

I can explain a bit tomorrow morning with a few links.

@EmilyBourne
Copy link
Member Author

EmilyBourne commented May 22, 2024

@EmilyBourne I am going to fork the devel-issue1886 branch which already have the pop() method implemented to avoid any conflicts

I think that is the simplest 👍

@EmilyBourne
Copy link
Member Author

EmilyBourne commented May 23, 2024

@shoaib-moeen
As for #1890, this issue is just about translating Python to Python. This is a little nonsensical but it allows us to ensure that the syntactic and semantic stages are working before printing in low-level languages like C or Fortran (usually the Python printer can be implemented fairly trivially). The main work for this PR will be to create an AST node which describes the popitem method. This issue is similar to other method issues for dicts (#1880-#1890) including #1886 which already has an associated PR (#1891). By forking devel-issue1886 you should therefore encounter the fewest conflicts and should be able to use superclasses that have already been implemented.

For more inspiration this issue is also similar to method issues for lists (#1689-#1701, summarised in #1567) and sets (#1738-#1754, summarised in #1569). Several of these have already been closed and these have associated PRs that you could look at.

I have included several links to docs in my description above. Please take a look for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants