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 r.david.murray
Recipients Juraj.Variny, bethard, chris.jerdonek, docs@python, ezio.melotti, r.david.murray, terry.reedy
Date 2012-11-14.12:23:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352895788.96.0.372618071671.issue16418@psf.upfronthosting.co.za>
In-reply-to
Content
I agree with Chris that using the repr in the general case would be a regression in usability for the end user (and certainly not suitable for a maintenance release).

Here is some brainstorming:

We could "special case" this via duck typing.  If the object that represents the choices has 'start' and 'stop' attributes, use those to generate a message.  ("from {start} up to but not including {stop}"). [*] If it doesn't, or it also has a 'step' that is not 1, check the len, generate the list if it is less than, say, 50, and if it is more give up and use the repr.

If there is no len, do the expansion (which is what happens now) and throw it away in favor of the repr if there are more than 50 elements.

If there is no iter, use the repr.

Then as an enhancement we can also look for a special attribute (values_description?) that gives the entire text to use in the parenthesis in the help phrase to provide a way to customize the help text in 3.4+.

[*] Or, at the risk of being too clever, if there is a 'step' use the message above and if there isn't a step attribute at all use "between {start} and {stop}.
History
Date User Action Args
2012-11-14 12:23:09r.david.murraysetrecipients: + r.david.murray, terry.reedy, bethard, ezio.melotti, chris.jerdonek, docs@python, Juraj.Variny
2012-11-14 12:23:08r.david.murraysetmessageid: <1352895788.96.0.372618071671.issue16418@psf.upfronthosting.co.za>
2012-11-14 12:23:08r.david.murraylinkissue16418 messages
2012-11-14 12:23:08r.david.murraycreate