Message326652
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__) |
|
Date |
User |
Action |
Args |
2018-09-28 18:50:44 | paul.j3 | set | recipients:
+ paul.j3, serhiy.storchaka, bubthegreat |
2018-09-28 18:50:44 | paul.j3 | set | messageid: <1538160644.47.0.545547206417.issue34827@psf.upfronthosting.co.za> |
2018-09-28 18:50:44 | paul.j3 | link | issue34827 messages |
2018-09-28 18:50:44 | paul.j3 | create | |
|