Created on Thu Oct 13 14:52:26 2022
@author: Daniel
- class watex.utils.box.Boxspace(**kws)[source]#
Bases:
dictIs a container object exposing keys as attributes.
BowlSpace objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, Boxspace[“value_key”], or by an attribute, Boxspace.value_key. Another option is to use Namespace of collection modules as:
>>> from collections import namedtuple >>> Boxspace = namedtuple ('Boxspace', [< attribute names >] )
However the explicit class that inhers from build-in dict is easy to handle attributes and to avoid multiple error where the given name in the names attributes does not match the expected attributes to fetch.
Examples
>>> from watex.utils.box import Boxspace >>> bs = Boxspace(pkg='watex', objective ='give water', version ='0.1.dev') >>> bs['pkg'] ... 'watex' >>> bs.pkg ... 'watex' >>> bs.objective ... 'give water' >>> bs.version ... '0.1.dev'