ndict#
- class ndict(*args, name='name', type=None, strict=True, **kwargs)[source]#
Bases:
objdict
A dictionary-like class that provides additional functionalities for handling named items.
- Parameters:
name (str) – The items’ attribute to use as keys.
type (type) – The expected type of items.
strict (bool) – If True, only items with the specified attribute will be accepted.
duplicates (bool) – If True, it accepts duplicated keys an renames the using enumeration. Default: False.
Examples:
networks = ss.ndict(ss.mf(), ss.maternal()) networks = ss.ndict([ss.mf(), ss.maternal()]) networks = ss.ndict({'mf':ss.mf(), 'maternal':ss.maternal()})
Methods