File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4793,7 +4793,8 @@ The ``GenericAlias`` object acts as a proxy for :term:`generic types
4793
4793
of a generic which provides the types for container elements.
4794
4794
4795
4795
The user-exposed type for the ``GenericAlias `` object can be accessed from
4796
- :data: `types.GenericAlias ` and used for :func: `isinstance ` checks.
4796
+ :class: `types.GenericAlias ` and used for :func: `isinstance ` checks. It can
4797
+ also be used to create ``GenericAlias `` objects directly.
4797
4798
4798
4799
.. describe :: T[X, Y, ...]
4799
4800
Original file line number Diff line number Diff line change @@ -262,11 +262,22 @@ Standard names are defined for the following types:
262
262
263
263
.. versionadded :: 3.10
264
264
265
- .. data :: GenericAlias
265
+ .. class :: GenericAlias(t_origin, t_args)
266
266
267
267
The type of :ref: `parameterized generics <types-genericalias >` such as
268
268
``list[int] ``.
269
269
270
+ ``t_origin `` should be a non-parameterized generic class, such as ``list ``,
271
+ ``tuple `` or ``dict ``. ``t_args `` should be a :class: `tuple ` (possibly of
272
+ length 1) of types which parameterize ``t_origin ``::
273
+
274
+ >>> from types import GenericAlias
275
+
276
+ >>> list[int] == GenericAlias(list, (int,))
277
+ True
278
+ >>> dict[str, int] == GenericAlias(dict, (str, int))
279
+ True
280
+
270
281
.. versionadded :: 3.9
271
282
272
283
.. data :: Union
You can’t perform that action at this time.
0 commit comments