Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.
brainprep.utils.bunch.Bunch¶
- class brainprep.utils.bunch.Bunch(**kwargs)[source]¶
Bases:
dictContainer 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.
- Parameters:
- **kwargsAny
Passed to dictionary constructor.
Examples
>>> from brainprep.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