Message180710
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:52 | terry.reedy | set | recipients:
+ terry.reedy, bethard, r.david.murray, chris.jerdonek |
2013-01-26 20:59:52 | terry.reedy | set | messageid: <1359233992.5.0.736609348346.issue16468@psf.upfronthosting.co.za> |
2013-01-26 20:59:52 | terry.reedy | link | issue16468 messages |
2013-01-26 20:59:52 | terry.reedy | create | |
|