'Difference between argparse.Namespace and types.SimpleNamespace?
It seems they both behave exactly the same – both are like dicts
but with .
literal to access an item, however none of it is even a subclass of another
from argparse import Namespace
from types import SimpleNamespace
issubclass(Namespace, SimpleNamespace) # False
issubclass(SimpleNamespace, Namespace) # False
So, are there any differences between them two?
Can argparse.Namespace
be used in all cases?
Solution 1:[1]
There once was a proposal to have the argparse
inherit. That said, just use the types
one if you are using a new enough Python; that's what it is there for.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |