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 A. Skrobov
Recipients A. Skrobov, docs@python
Date 2015-10-02.11:25:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Python 2.7.3 (default, Dec 18 2014, 19:10:20) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from argparse import ArgumentParser
>>> parser = ArgumentParser()
>>> parser.add_argument("--foo", help="foo", action='store_const')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/", line 1281, in add_argument
    action = action_class(**kwargs)
TypeError: __init__() takes at least 4 arguments (4 given)

First, the exception message is entirely unhelpful (you wanted at least 4, you got 4, what's your problem?)

Second, adding "const=None" to the invocation makes it succeed; but,  according to this argument defaults to "None", so it shouldn't be necessary to specify it explicitly. Thus, either the documentation or the implementation is wrong.
Date User Action Args
2015-10-02 11:25:46A. Skrobovsetrecipients: + A. Skrobov, docs@python
2015-10-02 11:25:46A. Skrobovsetmessageid: <>
2015-10-02 11:25:46A. Skrobovlinkissue25299 messages
2015-10-02 11:25:45A. Skrobovcreate