[docs] Expand documentation about type aliases and NewType in the typing module (issue 27644)

guido at python.org guido at python.org
Thu Jul 28 17:49:09 EDT 2016

Great! A few nits.

File Doc/library/typing.rst (right):

Doc/library/typing.rst:32: A type alias is defined by assigning the type
to the alias. In this example,
Can you try to make all lines you've added shorter than 80 chars? Even
the examples (examples with long lines cause annoying horizontal scroll

Doc/library/typing.rst:36: Vector = List[float]
I'd add an example that passes a List[float] into a function expecting a
Vector. E.g.

def sum(a: Vector): ...
sum([0.0, 1.1, 2.2])

Doc/library/typing.rst:92: Recall that type aliases declares two types
to be *equivalent* to one another.
"type aliases declares" -- plural subject with singular verb. Maybe "the
use of a type alias causes two types ..." ?

Doc/library/typing.rst:97: In contrast, ``NewType`` declares one type to
be a *derivative* of another.
derivative -> subtype


More information about the docs mailing list