flattening a dict
Terry Jones
terry at jon.es
Sun Feb 17 11:41:19 EST 2008
>>>>> "Arnaud" == Arnaud Delobelle <arnodel at googlemail.com> writes:
Arnaud> BTW, I keep using the idiom itertools.chain(*iterable). I guess
Arnaud> that during function calls *iterable gets expanded to a tuple.
Arnaud> Wouldn't it be nice to have an equivalent one-argument function
Arnaud> that takes an iterable of iterables and return the 'flattened'
Arnaud> iterable?
This reminds me of a function I wrote a while back that iterates over all
its arguments, even calling passed functions and iterating over their
results. I knew *even less* about Python then than I do now; please set
flamethrowers to "Constructive Criticism".
http://www.fluidinfo.com/terry/2007/05/07/iteranything/
Terry
More information about the Python-list
mailing list