Under the hood, aren't iterables just lists? What's the use of having wrappers like map filter list and others like them? What does something being a filter actually tell you, except for it's origin? When would (except for being shorter in for example list comprehensions) x be better than list(x) where x is an iterable?
One thing I've heard is that keeping map and filter as iterables is faster than using them as lists. Why is this? What difference is there under the hood that makes iterables faster?
The difference between iterable and list is like the difference between a flower and a rose.
All roses are flower, but not all flowers are rose.
All lists are iterable, but not all iterables are lists.
iterable
An object capable of returning its members one at a time. Iterables include all sequences type (like list, str, and tuples).
List is an iterable, and is having some other more specifics characteristics to list.
Check this out: https://docs.python.org/3.5/glossary.html especially on iterable part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With