Message175555
| Author |
chris.jerdonek |
| Recipients |
Juraj.Variny, bethard, chris.jerdonek, docs@python, ezio.melotti, r.david.murray, terry.reedy |
| Date |
2012年11月14日.09:38:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1352885907.07.0.0721329345291.issue16418@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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). |
|