paul j3 added the comment:

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.

----------
nosy: +paul.j3

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

Reply via email to