New submission from Eric Snow <[email protected]>:
types.SimpleNamespace does pretty much exactly the same thing as
argparse.Namespace. We should have the latter subclass the former. I expect
the only reason that wasn't done before is because SimpleNamespace is newer.
The only thing argparse.Namespace does differently is it supports the
contains() builtin. So the subclass would look like this:
class Namespace(types.SimpleNamespace):
"""..."""
def __contains__(self, key):
return key in self.__dict__
Alternately, we could add __contains__() to SimpleNamespace and then the
subclass would effectively have an empty body.
----------
components: Library (Lib)
messages: 358555
nosy: eric.snow
priority: normal
severity: normal
stage: test needed
status: open
title: Use types.SimpleNamespace for argparse.Namespace
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com