n_const.data_format¶
- class DataClass(**kwargs)[source]¶
Bases:
SimpleNamespace
Storage of constant values.
Both attribute access and dict-like key access are supported. Dict methods are almost fully supported except
[fromkeys|setdefault]
.- Parameters
kwargs (Any) – Arbitrary number of parameters in
key=value
format.
Examples
>>> param = DataClass(a=50, b="abc") >>> param.a 50 >>> param["b"] 'abc'
- get(key, default=None)[source]¶
Equivalent to
dict.get(key, default)
method.- Parameters
key (Hashable) –
default (Optional[Any]) –
- Return type
Any
- pop(key, default=<class 'KeyError'>)[source]¶
Equivalent to
dict.pop(key, default)
method.- Parameters
key (Hashable) –
default (Any) –
- Return type
Any