Author nstiurca
Recipients nstiurca
Date 2012-06-21.15:34:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To reproduce, try the following code:
from argparse import ArgumentParser
a = ArgumentParser()
args = a.parse_args(["biz"])
print args, args.foo_bar

Expected output:
Namespace(foo_bar='biz') biz

Actual output:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Namespace' object has no attribute 'foo_bar'

Other comments:
The positional argument 'foo-bar' becomes impossible to retrieve without explicitly passing keyword argument dest='foo_bar'. Hyphens in positional arguments should be automatically replaced with underscores just as with other arguments.

I have not tested if this problem occurs in Python versions newer than 2.6.
Date User Action Args
2012-06-21 15:34:07nstiurcasetrecipients: + nstiurca
2012-06-21 15:34:07nstiurcasetmessageid: <>
2012-06-21 15:34:06nstiurcalinkissue15125 messages
2012-06-21 15:34:05nstiurcacreate