jspahrsummers / adt

Algebraic data types for Python (experimental, not actively maintained)
MIT License
172 stars 14 forks source link

throw instead of return None for accessors that don't match constructor? #7

Closed jspahrsummers closed 5 years ago

jspahrsummers commented 5 years ago

Putting aside arguments about failing fast vs. failing safe, the ListADT example is a bit weird with the current behavior of returning None.

jspahrsummers commented 5 years ago

The new mypy plugin doesn't consider these to return Optional[…], so this is even more important now.