Skip to content

Disallow List[int] etc. as expressions #556

Closed

Description

@JukkaL

The current PEP 484 draft does not allow writing code like this:

x = List[int]()

Instead, the recommended way is using type annotations:

x = [] # type: List[int]
# or
y = Undefined(List[int])
y = []

See also: python/typing#9

Activity

  1. gvanrossum commented on Apr 6, 2016

    @gvanrossum
    Member

    (The PEP went back and forth a few times; Undefined was removed. Right now the PEP suggests using either a # type comment or defining an alias, e.g. IntList = List[int] after which you can say y = IntList().)

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions