Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:
I'll add that for 98% of the use cases of a linked list (where you just want fast access at the ends), you can use a `collections.deque` instead, and it will be faster (fewer dereferences) and more memory-efficient (fewer pointers to store). In the remaining 2% where a linked list is genuinely better (say in CPython's internal garbage collector), you're in a situation where you are already holding a node and you want to delete it or insert around it in constant time. (If you need to do a linear scan before deleting things, list comprehensions will already do what you need). In such situations, the construction is highly specialized for the application, so it's difficult to generalize the construction to an abstract data structure -- in particular, the "data" may need to access the next/previous "data" directly. It's also not inaccessibly hard to re-do every time you need it. ---------- nosy: +Dennis Sweeney _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42575> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com