I have developed a library to introduce tagged unions to python that uses
dataclasses to define disjoint members of the tagged union (by defining
them as Optional fields). With some additional validation I make sure that
only one of the fields is not None.

I find that it also fits well with the existing analysis tools and IDEs
(e.g. PyCharm) and doesn’t require any additional work in order to be
supported.

I would like to see some criticism and whether that could potentially be a
good candidate for python standard library in the future.


-- 
Andrey Cizov
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/IGSGFGEANPEAFZ53EQRTT7LBPPOII3WR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to