Skip to content

Commit

Permalink
Specify that type[] distributes over unions
Browse files Browse the repository at this point in the history
  • Loading branch information
InSyncWithFoo committed Aug 15, 2024
1 parent e74d960 commit 44bbb79
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 the same as ``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 44bbb79

Please sign in to comment.