Chris Jerdonek added the comment:

For the record, choices types implementing only __contains__ never worked in 
any cases.  (I should have said ArgumentParser.add_argument() raises a 
ValueError in the above.)

So I wonder if we should classify this as an enhancement and simply document 
the restriction in maintenance releases to iterable types.  Clearly the module 
was written under the assumption (in multiple places) that choices are iterable.

Also, if we do change this, perhaps we should fall back to displaying the 
metavar in help messages when naming the container rather than using repr().  A 
message like the following, for example, wouldn't be very helpful or look very 
good:

   invalid choice: 0 (choose from <__main__.Container object at 0x10555efb0>)

I think we should avoid letting Python creep into help and usage text.

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16468>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to