简体   繁体   中英

dictionary with custom ordering in python

Is there an available map-like data structure in python that supports custom ordering, insertion and deletion? I want to store (key,value) pairs where keys are int and values are object with many fields so that they are ordered by some particular fields of the value.

i am settled with a dict of (key, val) and a priority queue of tuple (score, key) where score is used for sorting and can be derived from the val object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM