Skip to content

chg: Make argparse.Namespace unpackable/iterable.#7862

Closed
bubthegreat wants to merge 1 commit intopython:masterfrom
bubthegreat:master
Closed

chg: Make argparse.Namespace unpackable/iterable.#7862
bubthegreat wants to merge 1 commit intopython:masterfrom
bubthegreat:master

Conversation

@bubthegreat
Copy link

Currently you cant use an argparse namespace iteratively or unpack
the values in the **args syntax. These slight changes allow iter
methods and unpacking for easier use in instantiating objects
based on the Namespace.

Example use:

class NewClass(object):
    def __init__(self, arg1, arg2, arg3):
        do_something(arg1, arg2, arg3)


thing = NewClass(**args)

Currently you cant use an argparse namespace iteratively or unpack
the values in the **args syntax.  These slight changes allow iter
methods and unpacking for easier use in instantiating objects
based on the Namespace.
@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

When your account is ready, please add a comment in this pull request
and a Python core developer will remove the CLA not signed label
to make the bot check again.

Thanks again for your contribution, we look forward to reviewing it!

@ned-deily
Copy link
Member

ned-deily commented Jun 22, 2018

Thanks for your suggested change, @bubthegreat. But for it to be considered, there are some additional steps to follow. All of these are covered in the Python Developer's Guide. First, you should check the Python issue tracker for any existing similar issues on argparse and open a new one, if none found, and reference the issue in the PR. Second, you will need to submit the contributor agreement, if you haven't already. And, third, and most important, the proposed PR has to compile and pass tests; you'll see that the Travis and VSTS tests have failed because, unfortunately, the six module is not part of the Python Standard Library so it can't be used for a change to Python itself.


import os as _os
import re as _re
import six as _six
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use third party packages in the standard library

@brettcannon
Copy link
Member

Thanks for the PR, but closing as the CLA has not been signed within the last month. If you do decide to sign the CLA we can re-open this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants