Skip to content

Commit

Permalink
Specify that type[] distributes over unions (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Sep 17, 2024
1 parent f816a64 commit d93fba9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/spec/special-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ Note that it is legal to use a union of classes as the parameter for
user = new_user(user_class)
...

However the actual argument passed in at runtime must still be a
``type[]`` distributes over unions:
``type[A | B]`` is :term:`equivalent` to ``type[A] | type[B]``.

However, the actual argument passed in at runtime must still be a
concrete class object, e.g. in the above example::

new_non_team_user(ProUser) # OK
Expand Down

0 comments on commit d93fba9

Please sign in to comment.