[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-17 Thread Joannah Nanjekye
Joannah Nanjekye added the comment: Opened issue37880 to track this change. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-17 Thread Joannah Nanjekye
Joannah Nanjekye added the comment: Since both the docs and implementation now match, I suggest we close this and open a new issue suggesting to change the implementation back to make const=None when action='store_const'. -- stage: needs patch -> resolved

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-17 Thread A. Skrobov
A. Skrobov added the comment: Joannah, I see that under #25314, the docs were updated to match the implementation: https://github.com/python/cpython/commit/b4912b8ed367e540ee060fe912f841cc764fd293 On the other hand, the discussion here (from 2015) and on #25314 (from 2016) includes

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-16 Thread Joannah Nanjekye
Joannah Nanjekye added the comment: > this argument defaults to "None" Am leaning to the fact that this works as required. The documentation does not just say defaults to none. It says: With the 'store_const' and 'append_const' actions, the const keyword argument must be given. For other

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-13 Thread paul j3
paul j3 added the comment: I'm not set up to work with the current development distribution (via github). All my proposed patches are diffs for earlier repos. Paul -- ___ Python tracker

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2019-08-13 Thread Joannah Nanjekye
Joannah Nanjekye added the comment: paul.j3, The fix looks promising. Do you want to open a PR with this fix? -- nosy: +nanjekyejoannah ___ Python tracker ___

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-03 Thread paul j3
paul j3 added the comment: The unittest file test_argparse.py tests add_argument parameters in class TestInvalidArgumentConstructors(TestCase) It looks at a dozen different categories of errors, mostly checking that they return the correct TypeError or ValueError. It does not check the

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread A. Skrobov
New submission from A. Skrobov: 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",

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread R. David Murray
R. David Murray added the comment: Oops, sorry, I missed the fact that you were pointing out a doc issue. -- resolution: out of date -> stage: resolved -> needs patch status: closed -> open ___ Python tracker

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread paul j3
paul j3 added the comment: A related issue is http://bugs.python.org/issue24754 argparse add_argument with action="store_true", type=bool should not crash In this case the user specified a parameter that the 'store_true' subclass did not accept. In both cases, 'parser.add_argument' does

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread R. David Murray
R. David Murray added the comment: I think your second to last choice (catch the error) is the only practical solution. It is also probably the best, since we need to support user-written action routines. -- ___ Python tracker

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread A. Skrobov
A. Skrobov added the comment: Thank you for confirming that the mismatch between the documentation and the behaviour is preserved in Python 3! Adding it to the list of affected versions. -- versions: +Python 3.5 ___ Python tracker

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread R. David Murray
R. David Murray added the comment: To clarify this for other readers: the issue here is that the arguments to add_argument are passed through the action routine, which in this case is store_const, and store_const is the one that requires 'const' be specified...which isn't made clear by either

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread R. David Murray
R. David Murray added the comment: Yes, the python2 TypeErrors for mimatched arguments are sub-optimal. This has been fixed in python3: >>> parser.add_argument('--foo', help="foo", action='store_const') Traceback (most recent call last): File "", line 1, in File

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread R. David Murray
R. David Murray added the comment: Hmm. After looking at the code, it may also be desirable to improve that error message at the argparse level, since there's a bit of not-immediately-obvious indirection going on there. -- ___ Python tracker

[issue25299] TypeError: __init__() takes at least 4 arguments (4 given)

2015-10-02 Thread paul j3
paul j3 added the comment: A fix that I am exploring would wrap the Action instantiation call in add_argument with a try/except block That is replace: def add_argument(...) action = action_class(**kwargs) ... with try: action