Skip to content

Commit

Permalink
Allow deriving NewType from another unique type (#271)
Browse files Browse the repository at this point in the history
See discussion in python/mypy#3465
  • Loading branch information
ilevkivskyi authored and gvanrossum committed May 30, 2017
1 parent f06c5be commit 25b7a87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pep-0484.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1590,8 +1590,9 @@ from ``UserId`` where ``int`` is expected. Examples::
num = UserId(5) + 1 # type: int

``NewType`` accepts exactly two arguments: a name for the new unique type,
and a base class. The latter should be a proper class, i.e.,
not a type construct like ``Union``, etc. The function returned by ``NewType``
and a base class. The latter should be a proper class (i.e.,
not a type construct like ``Union``, etc.), or another unique type created
by calling ``NewType``. The function returned by ``NewType``
accepts only one argument; this is equivalent to supporting only one
constructor accepting an instance of the base class (see above). Example::

Expand Down

0 comments on commit 25b7a87

Please sign in to comment.