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 chris.jerdonek, r.david.murray, terry.reedy
Date 2012-11-14.16:25:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352910344.11.0.950095920957.issue16468@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-11-14 16:25:44chris.jerdoneksetrecipients: + chris.jerdonek, terry.reedy, r.david.murray
2012-11-14 16:25:44chris.jerdoneksetmessageid: <1352910344.11.0.950095920957.issue16468@psf.upfronthosting.co.za>
2012-11-14 16:25:44chris.jerdoneklinkissue16468 messages
2012-11-14 16:25:43chris.jerdonekcreate