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 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).
History
Date User Action Args
2012-11-14 09:38:27chris.jerdoneksetrecipients: + chris.jerdonek, terry.reedy, bethard, ezio.melotti, r.david.murray, docs@python, Juraj.Variny
2012-11-14 09:38:27chris.jerdoneksetmessageid: <1352885907.07.0.0721329345291.issue16418@psf.upfronthosting.co.za>
2012-11-14 09:38:27chris.jerdoneklinkissue16418 messages
2012-11-14 09:38:26chris.jerdonekcreate