Revision 1881
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/iters.py | ||
---|---|---|
1 |
# Iterators |
|
1 |
# Iterators and iterables
|
|
2 | 2 |
|
3 |
def is_iterable(value): return getattr(value, '__iter__', False) |
|
4 |
|
|
3 | 5 |
def flatten(outer_iter): |
4 | 6 |
for iter_ in outer_iter: |
5 | 7 |
for el in iter_: yield el |
Also available in: Unified diff
iters.py: Added is_iterable()