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 paul.j3
Recipients mbussonn, paul.j3, py.user, serhiy.storchaka
Date 2015-06-03.17:13:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433351627.73.0.0304628682619.issue24338@psf.upfronthosting.co.za>
In-reply-to
Content
The code that converts '-' to '_' is independent of the code that uses 'prefix_chars'.

The '-' conversion handles a long standing UNIX practice of allowing that character in the middle of option flags.  It's an attempt to turn such flags into valid variable names.  There is a bug/issue about whether the conversion should be applied to positional argument 'dest' parameters.  

Is the use of other funny characters in optional flags common enough to warrant a patch?  It probably wouldn't be hard to convert all 'prefix_chars' to '_'.  But should it still convert '-', even if it isn't in that list?  What about users who are content with using 'getattr', and don't want the conversion?

Note also that you can invoke `parse_args` with your own custom Namespace object.

https://docs.python.org/3.4/library/argparse.html#the-namespace-object

This means you can write a Namespace class alternative that can handle funny characters in any way you want.  I discuss the use of custom Namespace classes in http://bugs.python.org/issue9351.

Between the availability of 'getattr' and namespace customization, I don't think there's anything here that requires a patch.  But I'm in favor of keeping the issue open for discussion.
History
Date User Action Args
2015-06-03 17:13:47paul.j3setrecipients: + paul.j3, py.user, serhiy.storchaka, mbussonn
2015-06-03 17:13:47paul.j3setmessageid: <1433351627.73.0.0304628682619.issue24338@psf.upfronthosting.co.za>
2015-06-03 17:13:47paul.j3linkissue24338 messages
2015-06-03 17:13:47paul.j3create