In the middle of the desert you can say anything you want

15 Dec 2021

Python Union typing

In Python 3.10+, Unions (Union[str, Path]) can be also written as str | Path1

… And the syntax str or Path I’ve been using and getting no errors from, apparently, doesn’t exist at all. TODO - why did it work?

  1. Built-in Types — Python 3.10.1 documentation ↩︎

Nel mezzo del deserto posso dire tutto quello che voglio.