Skip to content

Need to support @overload in non-stub files #175

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
gvanrossum opened this issue Jan 22, 2016 · 1 comment
Closed

Need to support @overload in non-stub files #175

gvanrossum opened this issue Jan 22, 2016 · 1 comment

Comments

@gvanrossum
Copy link
Member

This was brought up in python/mypy#1136 (comment) -- Tornado's utf8() function really needs to use @overload but, since they want to use inline annotations, they can't. The type would be something like

@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...  # or (unicode)->bytes, in PY2

This can't comfortably be expressed using type vars (at least I couldn't figure it out).

@gvanrossum
Copy link
Member Author

Sorry, this is a duplicate of #72. Let's continue the discussion there.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant