maxlength

Is there any faster alternative of collection.deque in Python

Is collection.deque the best implementation of constant length list in Python? Question: I want to limit the length of the list in python, when len(list) > limit, the first item will be removed, collection.deque can achieve it, however, will it be slower than: list_A = [2,4,6,8,11] length_limit = 5 while True: # do something to …

Total answers: 1