From 25b7a873f808bdc11bcea202402527fafd85c9c6 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Tue, 30 May 2017 18:56:56 +0200 Subject: [PATCH] Allow deriving NewType from another unique type (#271) See discussion in python/mypy#3465 --- pep-0484.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt index fe3293041..de010de78 100644 --- a/pep-0484.txt +++ b/pep-0484.txt @@ -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::