paul j3 <ajipa...@gmail.com> added the comment:

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__)

----------
nosy: +paul.j3

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to