Re:Why type hinting sucks (/r/Python)
by aflag on Saturday February 11, 2023 @08:13AM
(#34752056)
Passing an int and, if the value doesn't exist, a None can be expressed quite neatly like this: "Optional[int]"
[ Parent
| on HN ]
`int | None` is often prefered in the newest versions.
Re:Why type hinting sucks (/r/Python)
by codethief on Saturday February 11, 2023 @09:36AM
(#34752630)
I must have missed this. Union types using | are possible now?
Yes, saves the import and looks cleaner IMHO https://www.blog.pythonlibrary.org/2021/09/11/python-3-10-si...