iterable
Any object you can loop over with for, such as a list, string, tuple, dictionary, set, range, file or generator.
In more detail
Iteration is an agreement, not a type: an iterable is anything that can hand out an iterator when asked with iter(). Functions such as sum, sorted, list and join accept any iterable.
Related terms
- iterator — An object that produces the items of a sequence one at a time, on request, instead of all at once.
- for loop — A loop that runs its body once for each item in a list or other collection, setting a loop variable to the current item.
- generator — A function that can pause and resume, producing a series of values one at a time with yield, each only when it is requested.
Taught in
- Sorting, Keys And Lambdas — Hands-on Python: Complete Video Course & Book
- Paths And Files The Modern Way — Hands-on Python: Complete Video Course & Book
- Twelve Traps, One Shape Each — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- String Methods The Exam Picks — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Lambdas, map() And filter() — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Generators And Iterators — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep