R. David Murray added the comment:

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 


Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to