Skip to content

eds_scikit.utils.bunch

Vendored Bunch class from scikit-learn.

Bunch

Bunch(**kwargs)

Bases: dict

Container object exposing keys as attributes.

Bunch objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, bunch["value_key"], or by an attribute, bunch.value_key.

Examples:

>>> from sklearn.utils import Bunch
>>> b = Bunch(a=1, b=2)
>>> b['b']
2
>>> b.b
2
>>> b.a = 3
>>> b['a']
3
>>> b.c = 6
>>> b['c']
6
Source code in eds_scikit/utils/bunch.py
29
30
def __init__(self, **kwargs):
    super().__init__(kwargs)
Back to top