Skip to content

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

Closed

Description

@gvanrossum

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).

Activity

  1. gvanrossum commented on Jan 22, 2016

    @gvanrossum
    MemberAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions