Python Forum
testing if an iterator is empty
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
testing if an iterator is empty
#10
the code i was going to use this for gets an object passed via a method argument. it tests to see if it is an iterator using isinstance(the_arg,collections.abc.Iterator) then it would be nice to know if it is empty. but this is not essential to know. it could just handle things better, i'll still do the if not test in case i's an empty sequence.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
testing if an iterator is empty - by Skaperen - Feb-23-2022, 12:23 AM
RE: testing if an iterator is empty - by BashBedlam - Feb-23-2022, 12:59 AM
RE: testing if an iterator is empty - by Skaperen - Feb-24-2022, 08:20 PM
RE: testing if an iterator is empty - by Skaperen - Feb-24-2022, 08:23 PM
RE: testing if an iterator is empty - by BashBedlam - Feb-24-2022, 09:21 PM
RE: testing if an iterator is empty - by Skaperen - Feb-24-2022, 10:35 PM
RE: testing if an iterator is empty - by BashBedlam - Feb-24-2022, 10:40 PM
RE: testing if an iterator is empty - by Skaperen - Feb-25-2022, 02:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  multiplying an iterator Skaperen 9 3,367 Oct-12-2021, 07:07 PM
Last Post: Skaperen
  iterating an iterator by one step Skaperen 0 1,609 Feb-09-2021, 08:38 PM
Last Post: Skaperen
  modifying the origin of an iterator Skaperen 4 3,011 Mar-05-2020, 11:49 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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