Wishlist item: itertools.flatten
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Fri Mar 11 14:36:10 CET 2005
On 11 Mar 2005 13:32:45 +0200, rumours say that Ville Vainio
<ville at spammers.com> might have written:
>For quick-and-dirty stuff, it's often convenient to flatten a sequence
>(which perl does, surprise surprise, by default):
>[1, 2, 3, 'hello', 4]
>One such implementation is at
>but something like this would be handy in itertools as well.
>It seems trivial, but I managed to screw up several times when trying
>to produce my own implementation (infinite recursion).
See Python Library Reference, "5.16.3 Recipes". Now that all and any (also
presented as recipes there) are considered to be included, perhaps flatten gets
a chance too.
This is just a personal opinion, but I detest restraints on library (itertools
module in this case) expansion when talking about such useful *building blocks*.
What happened to "batteries included"?
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
More information about the Python-list