homepage

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 guilherme-pg
Recipients bethard, guilherme-pg
Date 2012年03月09日.00:48:33
SpamBayes Score 7.2164497e-16
Marked as misclassified No
Message-id <1331254114.08.0.807459942746.issue14233@psf.upfronthosting.co.za>
In-reply-to
Content
Trying to set a default value to arguments whose action is "append" causes argparse to raise AttributeError when such arguments are provided in the command line (see attached test case t1.py).
This happens because _AppendAction doesn't expect the presence of a default value for the argument: when the command line is parsed and the argument is found, _AppendAction attempts to append the new value to the list of old values, if any, or the old list. In case there is already a non-list default value, it attempts to append the new value to it, which raises the exception.
Is this intended behavior? If so, shouldn't ArgumentError be raised instead? It should also be easy to fix this issue otherwise, making _StoreAction ensure the old values are stored in a list before appending.
History
Date User Action Args
2012年03月09日 00:48:34guilherme-pgsetrecipients: + guilherme-pg, bethard
2012年03月09日 00:48:34guilherme-pgsetmessageid: <1331254114.08.0.807459942746.issue14233@psf.upfronthosting.co.za>
2012年03月09日 00:48:33guilherme-pglinkissue14233 messages
2012年03月09日 00:48:33guilherme-pgcreate

AltStyle によって変換されたページ (->オリジナル) /