Message180052
I don't disagree that this feature could be useful. I'm just not sure it should go into a maintenance release. It feels like an enhancement to me because to use this feature, the user will have to use the API in a way they haven't before, and we will probably have to do things like add documentation and examples for this new use case (e.g. explaining that users passing non-iterable choices will need to implement a user-friendly repr() for help to render nicely).
Also, it introduces new questions like: if we're going to be using repr() for that case, then why wouldn't we allow repr() to be used for iterable choices if the user would like to better control the behavior (e.g. for very long lists)? Why not have a unified way to deal with this situation (e.g. something like __argparse_repr__ with a better name, or else provide or document that certain formatters should be used)? These don't seem like bug-fix questions.
> As far as I know, the reason argparse iterates is to bypass the object's representation methods and produce custom, one-size-fits-all, usage and error messages.
Another possibility is that it was the most helpful message for the use case the writers originally had in mind. Certainly, for example, seeing the available choices '0, 1, 2, 3, 4' is more useful than seeing 'xrange(5)'. |
|
Date |
User |
Action |
Args |
2013-01-15 21:12:10 | chris.jerdonek | set | recipients:
+ chris.jerdonek, terry.reedy, bethard, r.david.murray, wim.glenn |
2013-01-15 21:12:10 | chris.jerdonek | set | messageid: <1358284330.07.0.140012108756.issue16468@psf.upfronthosting.co.za> |
2013-01-15 21:12:10 | chris.jerdonek | link | issue16468 messages |
2013-01-15 21:12:09 | chris.jerdonek | create | |
|