Skip to content

Instantly share code, notes, and snippets.

@deloschang
Created December 30, 2014 06:21
Show Gist options
  • Save deloschang/82c06a8540f425892dfd to your computer and use it in GitHub Desktop.
Save deloschang/82c06a8540f425892dfd to your computer and use it in GitHub Desktop.
(Pdb) master_cb
{'solar.Quote': [{'fx': 'solve', 'priority': 1}], 'system.System': [], 'system.Array': [{'fx': 'map_generation', 'priority': 10}]}
Extract callback and sort
res = [(k, x) for k,v in master_cb.items() for x in v]
res.sort(key=lambda x: x[1]['priority'], reverse=True)
(Pdb) res
[('system.Array', {'fx': 'map_generation', 'priority': 10}), ('solar.Quote', {'fx': 'solve', 'priority': 1})]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment