Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pipelined generator
#11
(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
akbarza likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  receive from a generator, send to a generator Skaperen 9 5,593 Feb-05-2018, 06:26 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020