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 paul.j3
Recipients bubthegreat, paul.j3, serhiy.storchaka
Date 2018-09-28.18:50:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538160644.47.0.545547206417.issue34827@psf.upfronthosting.co.za>
In-reply-to
Content
As documented in https://docs.python.org/3/library/argparse.html#the-namespace-object

you can create your own 'namespace' class, that does everything you want and more.  argparse makes very few assumptions about the object - using getattr, setattr, and hasattr where possible.

All that the argparse.Namespace class adds to a plain object is the ability to set initial attributes, and to display them in a pretty way.

Look at Namespace.__repr__ to see how it accesses its attributes.

For a function with a

    fn(*args, **kwargs)

signature, a namespace 'ns', can be passed in in 2 ways:

   fn(*ns._get_kwargs(), **ns.__dict__)
History
Date User Action Args
2018-09-28 18:50:44paul.j3setrecipients: + paul.j3, serhiy.storchaka, bubthegreat
2018-09-28 18:50:44paul.j3setmessageid: <1538160644.47.0.545547206417.issue34827@psf.upfronthosting.co.za>
2018-09-28 18:50:44paul.j3linkissue34827 messages
2018-09-28 18:50:44paul.j3create