This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author desbma
Recipients barry, desbma, paul.j3
Date 2015-09-13.17:13:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442164417.61.0.511762807963.issue25061@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-09-13 17:13:37desbmasetrecipients: + desbma, barry, paul.j3
2015-09-13 17:13:37desbmasetmessageid: <1442164417.61.0.511762807963.issue25061@psf.upfronthosting.co.za>
2015-09-13 17:13:37desbmalinkissue25061 messages
2015-09-13 17:13:37desbmacreate