Message175499
> 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. |
|
Date |
User |
Action |
Args |
2012-11-13 14:03:28 | chris.jerdonek | set | recipients:
+ chris.jerdonek, terry.reedy, bethard, ezio.melotti, r.david.murray, docs@python, Juraj.Variny |
2012-11-13 14:03:28 | chris.jerdonek | set | messageid: <1352815408.63.0.60817332787.issue16418@psf.upfronthosting.co.za> |
2012-11-13 14:03:28 | chris.jerdonek | link | issue16418 messages |
2012-11-13 14:03:28 | chris.jerdonek | create | |
|