Author py.user
Recipients py.user
Date 2015-05-31.11:01:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433070096.48.0.744562806973.issue24338@psf.upfronthosting.co.za>
In-reply-to
Content
>>> import argparse
>>> 
>>> parser = argparse.ArgumentParser()
>>> _ = parser.add_argument('foo bar')
>>> _ = parser.add_argument('--x --y')
>>> args = parser.parse_args(['abc'])
>>> 
>>> args
Namespace(foo bar='abc', x __y=None)
>>> 
>>> 'foo bar' in dir(args)
True
>>> 'x __y' in dir(args)
True
>>>

Passing wrong arguments silently makes a namespace which attributes are not accessible.

ISTM, add_argument() should raise a ValueError exception.
History
Date User Action Args
2015-05-31 11:01:36py.usersetrecipients: + py.user
2015-05-31 11:01:36py.usersetmessageid: <1433070096.48.0.744562806973.issue24338@psf.upfronthosting.co.za>
2015-05-31 11:01:36py.userlinkissue24338 messages
2015-05-31 11:01:36py.usercreate