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

Evaluation order of "r" magic methods #145

Closed
arshajii opened this issue Dec 30, 2022 · 1 comment
Closed

Evaluation order of "r" magic methods #145

arshajii opened this issue Dec 30, 2022 · 1 comment
Assignees

Comments

@arshajii
Copy link
Contributor

class A:
    def __radd__(self, n: int):
        return 0

def f():
    print('f')
    return 1

def g():
    print('g')
    return A()

f() + g()

Python gives f g but Codon gives g f, probably because Codon transforms this to A.__radd__(g(), f()) while it should really be transformed to tmp1 = f(); tmp2 = g(); A.__radd__(tmp2, tmp1).

@inumanag inumanag self-assigned this Jan 4, 2023
@inumanag
Copy link
Contributor

inumanag commented Nov 8, 2024

Fixed in #604.

@inumanag inumanag closed this as completed Nov 8, 2024
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

No branches or pull requests

2 participants