typed_python
typed_python copied to clipboard
Alternatives should have their name in `__name__`
Currently, one can access the name of an alternative with alt.Name which is not very pythonic. It is probably better to switch to alt.__name__ instead. Besides not being pythonic, using Name is a bit risky because a user may define Name to be a member of one of the alternatives which could use to very confusing behavior.
Actually, it might be better to use __alternative__ instead, because __name__ already has a meaning in python. And it might be preferable to keep alt.Name for backwards compatibility.