News for hackers. Stuff that matters.
Re:Returns: Brings functional programming to Python land by BerislavLopac on Tuesday February 20, 2024 @01:28PM (#39444858)
They're both perfectly valid; but the expression style [0] is shorter and more obvious, especially compared to Optional. Even the documentation for Optional states [1]:

  Note that this is not the same concept as an optional argument, which is one that has a default.
[0] https://docs.python.org/3.11/library/stdtypes.html#types-uni...

[1] https://docs.python.org/3.11/library/typing.html#typing.Opti...

There are no comments on this comment yet.