Message175555
> The code could simply use the str or repr of the choice object
It seems to me that this would result in less user-friendly behavior in many cases. It would also require the end-user to understand Python (e.g. xrange and dictionaries), which I don't think should be necessary for the user of a command-line script.
For example, in Python 2.7 the containers xrange(5, 10), xrange(2, 10, 2), and {1: "foo", 2: "bar"} currently yield the following user-friendly messages for choice 0:
invalid choice: 0 (choose from 5, 6, 7, 8, 9)
invalid choice: 0 (choose from 2, 4, 6, 8)
invalid choice: 0 (choose from 1, 2)
With the proposed change, these messages would be as follows, which seem unnecessarily obfuscated:
invalid choice: 0 (choose from xrange(5, 10))
invalid choice: 0 (choose from xrange(2, 10, 2))
invalid choice: 0 (choose from {1: 'foo', 2: 'bar'})
Thus, I think the proposal above would be a regression if applied. I think any changes to maintenance releases should preserve the current user-friendly messages (when those messages are user-friendly, e.g. when the containers are small). |
|
Date |
User |
Action |
Args |
2012-11-14 09:38:27 | chris.jerdonek | set | recipients:
+ chris.jerdonek, terry.reedy, bethard, ezio.melotti, r.david.murray, docs@python, Juraj.Variny |
2012-11-14 09:38:27 | chris.jerdonek | set | messageid: <1352885907.07.0.0721329345291.issue16418@psf.upfronthosting.co.za> |
2012-11-14 09:38:27 | chris.jerdonek | link | issue16418 messages |
2012-11-14 09:38:26 | chris.jerdonek | create | |
|