Oct-31-2023, 12:45 PM
(This post was last modified: Oct-31-2023, 12:45 PM by Gribouillis.)
(Oct-31-2023, 10:59 AM)akbarza Wrote: is there any guide about deque?Deque is only a type in the standard library. It is documented here. You could also read this.
However, the expression I used above
item = deque(iterable, maxlen=1)[-1]is only a trick to obtain the last element of a non empty iterable. You could replace it with a loop
for item in iterable: pass