Search code examples
pythoncollectionsdeque

What are the possible applications of deque functions in real time use?


Help me learn with the application of real time use of deque functions from collection library, if possible try adding some examples to it .

Thank You.


Solution

  • the docs for deque itself nominates two examples, given that maxlen is provided:

    Bounded length deques provide functionality similar to the tail filter in Unix. They are also useful for tracking transactions and other pools of data where only the most recent activity is of interest.