Antoine Pitrou added the comment: Le 29/07/2014 21:15, Raymond Hettinger a écrit : > > * One use case for the insert methods is trying to maintain a sort order (such as an alphabetical order) but we don't have any efficient search methods such as a binary search to find an insertion point. For example, if I read an alphabetically sorted config file of key / value pairs, how would I insert a new key/value pair in the proper position?
You'd certainly prefer a tree for that use case (O(log n) search and insertion rather than O(n) search and O(1) insertion). I hadn't thought about the set operations. The use case here is really linked-list-alike, not set-alike. I'm mildly relieved that, even though O(n), middle-of-list insertions are still plenty fast for reasonable sizes, which means Numba shouldn't suffer here (even though we do seem to have users generating Python code and then JIT-compiling it...). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22097> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com