• @[email protected]
    link
    fedilink
    -29 months ago

    When you need a doubly-linked list in Python, you can use the deque data structure, which is in the collections module

    When do I need a doubly-linked list in Python? Whenever I have something where I can often expect to interact with the first and last element of it? Always, because it’s more efficient than shifting the entire list around? Something else entirely?