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 terry.reedy
Recipients bethard, chris.jerdonek, r.david.murray, terry.reedy
Date 2013-01-26.20:59:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think we have converged on the right solution. The patch looks good as far as it goes, assuming that it passes the current + unwritten new tests. It will also be a good basis for reconsidering what to do with long/infinite iterables in #16418.

I think the doc patch should recommend passing a metavar arg with non-iterable choices. With that, using default metavars, whatever they end up being, is fine as long as no exception is raised. So I would make the tests of non-iterable with no metavar passed as general as possible. App writers who do not like the defaults should override them ;-).

If I understand correctly, if choices is not iterable and the user enters an invalid choice, the choice part of the error message (passed to ArgumentError) will just be 'invalid choice: <value>'.

Minor nit: .join does not need a temporary list as arg and works fine with genexp:
choices_str = sep.join(to_str(choice) for choice in choices)
Date User Action Args
2013-01-26 20:59:52terry.reedysetrecipients: + terry.reedy, bethard, r.david.murray, chris.jerdonek
2013-01-26 20:59:52terry.reedysetmessageid: <>
2013-01-26 20:59:52terry.reedylinkissue16468 messages
2013-01-26 20:59:52terry.reedycreate