[issue10190] Can argparse._AttributeHolder._get_kwargs become a public API?
Raymond Hettinger
report at bugs.python.org
Fri Aug 30 02:15:40 EDT 2019
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Marking this as out-of-date. It seems that the desired functionality has already been added in types.SimpleNamespace:
# Capabilities of _AttributeHolder
>>> ah = _AttributeHolder()
>>> ah
AttributeHolder()
>>> ah.raymond='Red'
>>> ah
AttributeHolder(raymond='Red')
>>> ah.raymond
'Red'
>>> ah.rachel='blue'
>>> ah
AttributeHolder(rachel='blue', raymond='Red')
>>> ah._get_kwargs()
[('rachel', 'blue'), ('raymond', 'Red')]
# Capabilities of SimpleNamespace
>>> import types
>>> ah = types.SimpleNamespace()
>>> ah.raymond='Red'
>>> ah
namespace(raymond='Red')
>>> ah.rachel='blue'
>>> ah
namespace(rachel='blue', raymond='Red')
>>> vars(ah).items()
dict_items([('raymond', 'Red'), ('rachel', 'blue')])
----------
resolution: -> out of date
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue10190>
_______________________________________
More information about the Python-bugs-list
mailing list