defaultdict_fromkey

Inheritance diagram of defaultdict_fromkey
class defaultdict_fromkey[source]

Creates a dictionary with a default_factory function that creates new elements using key as argument.

Usagenew_dict = defaultdict_fromkey(method)

where method like (lambda key: return new_obj(key))

Each time that new_dict[key] is called with a key that doesn’t exist, method(key) is used to create the value Copied from PyAlarm device server

Import from taurus.core.util.containers as:

from taurus.core.util.containers import defaultdict_fromkey