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

levkivskyi at gmail.com levkivskyi at gmail.com
Thu Jul 28 18:11:37 EDT 2016


I would add two small comments


http://bugs.python.org/review/27644/diff/18004/Doc/library/typing.rst
File Doc/library/typing.rst (right):

http://bugs.python.org/review/27644/diff/18004/Doc/library/typing.rst#newcode65
Doc/library/typing.rst:65: The static type checker will treat the new
type almost as if it were a subclass
It is not clear why do you need word "almost" here.
NewType creates something that type checker treats as equivalent of a
subclass with only one constructor that accepts an instance of the base
class.

http://bugs.python.org/review/27644/diff/18004/Doc/library/typing.rst#newcode86
Doc/library/typing.rst:86: More precisely, the expression ``some_value
== Derived(some_value)`` is always true at runtime.
I would replace here ``some_value == Derived(some_value)`` with
``some_value is Derived(some_value)``

http://bugs.python.org/review/27644/


More information about the docs mailing list