ndict#
- class ndict(*args, nameattr='name', type=None, strict=True, overwrite=False, **kwargs)[source]#
Bases:
objdict
A dictionary-like class that provides additional functionalities for handling named items.
- Parameters:
name (str) – The attribute of the item to use as the dict key (i.e., all items should have this attribute defined)
type (type) – The expected type of items.
strict (bool) – If True, only items with the specified attribute will be accepted.
overwrite (bool) – whether to allow adding a key when one has already been added
Examples:
networks = ss.ndict(ss.MFNet(), ss.MaternalNet()) networks = ss.ndict([ss.MFNet(), ss.MaternalNet()]) networks = ss.ndict({'mf':ss.MFNet(), 'maternal':ss.MaternalNet()})
Methods