defaultdict_fromkey
¶
digraph inheritance49c835ca04 {
rankdir=UD;
ratio=compress;
size="8.0, 12.0";
"defaultdict" [color=dodgerblue1,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="defaultdict(default_factory[, ...]) --> dict with default factory"];
"defaultdict_fromkey" [color=dodgerblue1,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="Creates a dictionary with a default_factory function that creates new elements using key as argument."];
"defaultdict" -> "defaultdict_fromkey" [arrowsize=0.5,style="setlinewidth(0.5)"];
}
-
class
defaultdict_fromkey
[source]¶ Bases:
collections.defaultdict
Creates a dictionary with a default_factory function that creates new elements using key as argument. Usage : new_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