Skip to content

Commit 25b7a87

Browse files
ilevkivskyigvanrossum
authored andcommitted
Allow deriving NewType from another unique type (#271)
See discussion in python/mypy#3465
1 parent f06c5be commit 25b7a87

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pep-0484.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,8 +1590,9 @@ from ``UserId`` where ``int`` is expected. Examples::
15901590
num = UserId(5) + 1 # type: int
15911591

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

0 commit comments

Comments
 (0)