We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
From testing the second block of code here, but with a more explicit example:
https://docs.exaloop.io/codon/language/classes
class Foo: x: int y: int def __init__(self): # constructor self.x, self.y = 0, 0 print('empty', self.x, self.y) def __init__(self, x: int, y: int): # another constructor self.x, self.y = x, y print('int int', self.x, self.y) def __init__(self, x: int, y: float): # yet another constructor self.x, self.y = x, int(y) print('int float', self.x, self.y) Foo() Foo(1, 2) Foo(1, 2.3) a: int = 3 b: int = 5 Foo(a, b)
Output:
> codon run example.py empty 0 0 int float 1 2 <- should be int int 1 2 int float 1 2 int float 3 5 <- should be int int 3 5
Note that swapping the __init__ order so that the float constructor is first works successfully. (i.e. method definition order matters)
__init__
The text was updated successfully, but these errors were encountered:
No branches or pull requests
From testing the second block of code here, but with a more explicit example:
https://docs.exaloop.io/codon/language/classes
Output:
Note that swapping the
__init__
order so that the float constructor is first works successfully. (i.e. method definition order matters)The text was updated successfully, but these errors were encountered: