[issue42501] Improve error messages for argparse choices using enum

2020-11-30 Thread Raymond Hettinger
Change by Raymond Hettinger : -- components: +Documentation -Library (Lib) resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue42501] Improve error messages for argparse choices using enum

2020-11-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset aab93903347ec6d7f23dda2994dd26f6111d19d2 by Miss Islington (bot) in branch '3.9': bpo-42501: Revise the usage note for Enums with the choices (GH-23563) (GH-23573)

[issue42501] Improve error messages for argparse choices using enum

2020-11-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 7f82f22eba1312617e1aa19cb916da1aae1609a4 by Raymond Hettinger in branch 'master': bpo-42501: Revise the usage note for Enums with the choices (GH-23563) https://github.com/python/cpython/commit/7f82f22eba1312617e1aa19cb916da1aae1609a4

[issue42501] Improve error messages for argparse choices using enum

2020-11-30 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 4.0 -> 5.0 pull_requests: +22454 pull_request: https://github.com/python/cpython/pull/23573 ___ Python tracker

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: How does PR 23563 look to you all? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +22444 stage: -> patch review pull_request: https://github.com/python/cpython/pull/23563 ___ Python tracker

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread paul j3
paul j3 added the comment: choices is fine for a few strings, but quickly becomes awkward with other types and large numbers. The testing isn't an issue, since it just does a simple `in/contains` test. But display, whether in usage, help or error, is problematic if you try anything too

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread shangxiao
shangxiao added the comment: Oh apologies, I had "open" selected when I searched for prior issues. Upon reading that issue I agree with Mr Hettinger's points about enum values not being a concern of the parser. The solution for my needs was simple enough: I made my own action which simply

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: https://bugs.python.org/issue25061 also had some discussion over error message display for enums -- nosy: +xtreak ___ Python tracker

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm inclined to state in the docs that choices is designed to work with collections of strings and that there is no special support for enums. Paul, what do you think? -- ___ Python tracker

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +paul.j3, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42501] Improve error messages for argparse choices using enum

2020-11-29 Thread shangxiao
New submission from shangxiao : Summary --- The argparse module mentions that it will happily accept an enum for the choices argument option [1]. There are currently 2 issues with this: 1. The usage displays non user-friendly values for the enum; 2. The error message for invalid values