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

overloaded functions can get translated to invalid python #5

Closed
ashleyh opened this issue Dec 8, 2012 · 0 comments
Closed

overloaded functions can get translated to invalid python #5

ashleyh opened this issue Dec 8, 2012 · 0 comments
Labels
bug mypy got something wrong

Comments

@ashleyh
Copy link
Contributor

ashleyh commented Dec 8, 2012

Contrived example:

def print_type(int x):
    print('int')

def print_type(x):
    print('unknown')

translates to

def print_type(x):
    def print_type1(x):
        print('int')

    def print_type2(x):
        print('unknown')

    if isinstance(x, int):
        return print_type1(x)
    elif : # <--- invalid syntax
        return print_type2(x)
    else:
        raise TypeError("Invalid argument types")

(comment added by me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants