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

    Mar 27, 2012 · An iterable is an object that has an iter() method which returns an iterator. It is something that can be looped over. Example : A list is iterable because we can loop over a list …

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

    if iterable(obj): # act on iterable else: # not iterable as you would do with thecallable function. EDIT: if you have numpy installed, you can simply do: from numpy import iterable, which is …

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

    This is how the term "iterable" is defined in Python's doc: iterable. An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, …

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

    Jul 28, 2011 · On the flip side, Iterable is another interface, which, if implemented by a class forces the class to be Iterable and is a target for For-Each construct. It has only one method …

  5. Checking whether something is iterable - Stack Overflow

    Sep 19, 2013 · Keep in mind that the word iterable specifically refers to the iterable protocol, though there exist different ways to loop over objects. The following list is not exhaustive: …

  6. Python type hint for Iterable [str] that isn't str

    Mar 29, 2022 · A str is valid as an Iterable[str] type, but that may not be the correct input for a function. For example, in this trivial example that is intended to operate on sequences of …

  7. How do I fix TypeError: 'int' object is not iterable?

    But in Python, the thing you pass to a for statement needs to be some kind of iterable object. In this case, what you want is just a range statement. This will generate a list of numbers, and …

  8. python - collections.Iterable vs typing.Iterable in type annotation …

    Oct 16, 2018 · The typing.Iterable is generic, so you can say what it's an iterable of in your type annotations, e.g. Iterable[int] for an iterable of ints. The collections iterable is an abstract base …

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

    Apr 28, 2025 · 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 …

  10. Java 8 Iterable.forEach() vs foreach loop - Stack Overflow

    May 19, 2013 · It is always good practice, to use the right tool for doing the job, and this includes mixing traditional for-each loops with Iterable#forEach, where it makes sense. Since the …

Refresh