desbma added the comment:
I would like the enum type to be stored directly.
With your approach, the user does not know what are the possible choices, until
he/she tries a invalid value and get the exception. If I pass the enum type to
the choice parameter, the help message is not very user friendly
("<CustomEnumType.VAL1: 1>"...) and does not accurately represent possible
input strings.
Anyway, my first example snippet works and does what I need, but it feels a bit
like a hack.
In my opinion this is a classic use case for enums, that should be handled more
naturally by the argparse module.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com