I'm using Python 2.7.3.

It looks like ArgumentParser maps "--foo-bar" to "foo_bar" in the argument 
namespace, but doesn't do the same kind of mapping for positional arguments.  
Is this intentional?  I can't find in the docs where it describes this mapping, 
but it's certainly convenient, and seems wrong that it doesn't do it everywhere.

---------------------------------
from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument("upload-dir")
parser.add_argument("--file-name")
args = parser.parse_args()
print args
---------------------------------

$ python args.py  x
Namespace(file_name=None, upload-dir='x')


---
Roy Smith
r...@panix.com



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to