Its easy to sort a dict to list by values, but I need to order keys by kind of boosting specific values in correlation to others.
An example:
x = [('key1', {'s': 'foo', 'w': 30}), ('key2', {'s': 'bar', 'w': 26}),
('key3', {'s': 'foo', 'w': 23}), ('key4', {'s': 'bar', 'w': 13})]
result: ['key2', 'key1', 'key3', 'key4']
The stuff is ordered by 'w', but for 's' we prefer 'bar' over 'foo' if 'w' hits some treshold. Is this somehow implemented in python, are there any rules to do this or do you know a python library to handle it?
Its not about learning the features, its about ordering the way I specify - boost or restrict - the values.