Hello everybody!
I've a list of dictionaries with 'shorcut' and 'command' keys. When user
types a word program must search this list for a typed shortcut and then run
linked command. What I've wrote:
for cmd in self.commands:
if cmd['shortcut'] == input:
os.popen(cmd['command'])
break
else:
os.popen(input)
But it's a brute-force method and I think there is another way in searching
items through a list by dictionary key. Please give me advice how can I
implement fast search in list of dictionaries by some dictionary key. In my
mind language:
list.get({'shortcut' == input})
Thanks a lot, Alex
--
http://mail.python.org/mailman/listinfo/python-list