I need to create a dictionary with Locks
as values, but I can't use dict.fromkeys
because it creates only one Lock and multiple references:
my_dict = dict.fromkeys(list_of_keys, Lock())
So I do it like:
my_dict = dict((my_key,Lock()) for my_key in list_of_keys)
But I wonder if it's possible to use dict.fromkeys
in any way,