Preferred python typing syntax of Optional[Union] vs. Union[None]

Viewed 1082

As far as I can gather, the following two types are equivalent in Python:

Optional[Union[A, B]]

Union[A, B, None]

Is there a defined convention for which one to choose, such as a clause in PEP?

0 Answers
Related