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-13.14:03:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352815408.63.0.60817332787.issue16418@psf.upfronthosting.co.za>
In-reply-to
Content
> Does argparse actually convert (x)range objects to a list or set (the help indicates the latter) for internal use?

No, it leaves the provided choices argument as is.

Here is what the documentation says argparse accepts: "Any object that supports the *in* operator can be passed as the choices value, so dict objects, set objects, custom containers, etc. are all supported."  And here is the code for testing containment:

http://hg.python.org/cpython/file/ee7b713fec71/Lib/argparse.py#l2284

Terry, are you okay with the proposed documentation patch?

Special-casing the display of range values seems like an enhancement request to me rather than a bug.  I would suggest that be handled as an enhancement request targeted initially for Python 3.4.  I would be happy to create a new issue for that.  Alternatively, it could be considered as a second patch on this issue.
History
Date User Action Args
2012-11-13 14:03:28chris.jerdoneksetrecipients: + chris.jerdonek, terry.reedy, bethard, ezio.melotti, r.david.murray, docs@python, Juraj.Variny
2012-11-13 14:03:28chris.jerdoneksetmessageid: <1352815408.63.0.60817332787.issue16418@psf.upfronthosting.co.za>
2012-11-13 14:03:28chris.jerdoneklinkissue16418 messages
2012-11-13 14:03:28chris.jerdonekcreate