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

Inheritance oddness #208

Closed
jplevyak opened this issue Mar 11, 2023 · 1 comment
Closed

Inheritance oddness #208

jplevyak opened this issue Mar 11, 2023 · 1 comment

Comments

@jplevyak
Copy link

jplevyak commented Mar 11, 2023

class A:
    n = 2
class B(A):
    o = 3
print(B().n)

python3 produces '3' while codon produces: error: 'B' object has no attribute 'n'

If I rewrite it as:

class A:
    def __init__(self):
        self.n = 2
class B(A):
    def __init__(self):
        A.__init__(self)
        self.o = 3
print(B().n)

codon produces:

y.py:3:9-13: error: 'A' object has no attribute 'n'
├─ y.py:6:9-25: error: during the realization of init(self: A)
╰─ y.py:8:7-12: error: during the realization of init(self: B)

@inumanag
Copy link
Contributor

inumanag commented Nov 8, 2024

Please see #211 for the explanation and #606 to track the implementation progress.

@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