-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ArgumentParser's add_argument returns the Action that was created. #1881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ArgumentParser's add_argument returns the Action that was created. #1881
Conversation
Here's what I think we should do:
|
These are made unnecessary by python/typeshed#1881
Running typeshed's mypy_selftest.py against the PR'd version of both mypy and typeshed results in:
It appears that
(same behavior in 3.6.1). dest=None handled here:
I guess I'll also change dest to |
…ument should also return the Action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look forward to this and python/mypy#4578 :)
These are made unnecessary by python/typeshed#1881
…ython#1881) * ArgumentParser's add_argument returns the Action that was created. * Make add_argument's dest parameter Optional. _ArgumentGroup's add_argument should also return the Action.
Fixes #1878
I added the member variables of Action to fix this error with mypy_selftest:
However, currently I'm getting:
I suppose to fix this I would have to remove the
type: ignore
line in mypy (now that it's unnecessary), but it seems that would cause a chicken-and-egg problem: such a PR against mypy would fail tests until this PR is merged.