← Back to DAGDA | Support | Source: https://github.com/ambv/static-annotations/commit/77623f6ada94212c672315aa0ae3bf3d91251496
Skip to content
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

Commit 77623f6

Browse files
author
Lukasz Langa
committed
Make type names abstract when discussing forward references
1 parent 91c038d commit 77623f6

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎pep-0563.rst‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,22 +284,23 @@ forward references with string literals. The list includes:
284284

285285
* type definitions::
286286

287-
T = TypeVar('T', bound='UserId')
288-
UserId = NewType('UserId', 'SomeType')
289-
Employee = NamedTuple('Employee', [('name', str), ('id', 'UserId')])
287+
T = TypeVar('T', bound='<type>')
288+
UserId = NewType('UserId', '<type>')
289+
Employee = NamedTuple('Employee', [('name', '<type>', ('id', '<type>')])
290290

291291
* aliases::
292292

293-
Alias = Optional['SomeType']
294-
AnotherAlias = Union['SomeType', 'OtherType']
293+
Alias = Optional['<type>']
294+
AnotherAlias = Union['<type>', '<type>']
295+
YetAnotherAlias = '<type>'
295296

296297
* casting::
297298

298-
cast('SomeType', value)
299+
cast('<type>', value)
299300

300301
* base classes::
301302

302-
class C(Tuple['SomeType', 'OtherType']): ...
303+
class C(Tuple['<type>', '<type>']): ...
303304

304305
Depending on the specific case, some of the cases listed above might be
305306
worked around by placing the usage in a ``if TYPE_CHECKING:`` block.

0 commit comments

Comments
 (0)