About 3,680,000 results
Open links in new tab
  1. What are iterator, iterable, and iteration? - Stack Overflow

    So an iterable is an object that you can get an iterator from. An iterator is an object with a next (Python 2) or __next__ (Python 3) method. Whenever you use a for loop, or map, or a list comprehension, …

  2. What exactly does "iterable" mean in Python? Why isn't my object …

    First I want to clarify, I'm NOT asking what is "iterator". This is how the term "iterable" is defined in Python's doc: iterable An object capable of returning its members one at a time.

  3. Python: how to determine if an object is iterable?

    Checking isinstance(obj, Iterable) detects classes that are registered as Iterable or that have an __iter__() method, but it does not detect classes that iterate with the __getitem__() method. The only …

  4. java - What is the difference between iterator and iterable and how to ...

    Jul 28, 2011 · An Iterable is a simple representation of a series of elements that can be iterated over. It does not have any iteration state such as a "current element". Instead, it has one method that …

  5. python - How to build a basic iterator? - Stack Overflow

    If you want to be able to iterate ctr more than once, it needs to be a non-iterator iterable, where it returns a brand new iterator each time __iter__ is invoked. Trying to mix and match (an iterator that is …

  6. How does a Python for loop with iterable work? - Stack Overflow

    Sep 5, 2019 · The for statement just defines how iterable and iterator are used. If you are mostly familiar with external iteration, it helps looking at iterable and iterator as well.

  7. How can I tell the difference between an iterator and an iterable?

    The iterable is also provided by the user, and for situations where a single pass is enough it will work with an iterator (e.g., created by a generator for simplicity). But it would be nice to safeguard against …

  8. TypeError: 'NoneType' object is not iterable - Stack Overflow

    Nov 12, 2023 · For example if data is a value returned from a function, then make sure that function returns an iterable object (such as list, numpy ndarray, pandas DataFrame etc.). If data is the value …

  9. python - collections.Iterable vs typing.Iterable in type annotation and ...

    Oct 16, 2018 · The collections iterable is less likely to cause problems as a superclass. So in short, you should use the typing iterable in type annotations, but the collections iterable as a superclass.

  10. Easy way to convert Iterable to Collection - Stack Overflow

    Iterable<X> iterable = repo.findAll(); List<X> list = Streamable.of(iterable).toList(); And since you mention being upset, maybe a little background for the decision to use Iterable help as well. It is …