Recursive list comprehension
Nick Coghlan
ncoghlan at iinet.net.au
Mon Dec 6 07:04:12 EST 2004
More information about the Python-list mailing list
Mon Dec 6 07:04:12 EST 2004
- Previous message (by thread): Recursive list comprehension
- Next message (by thread): Recursive list comprehension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Peter Otten wrote: > Nick Coghlan wrote: > > >>from itertools import chain >>n = [['N', 'F'], ['E'], ['D']] >>print [chain(*n)] > > > However, [generator] is not the same as list(generator): Heh - good point. As you say, replacing with list() gives the intended answer. With regards to laziness, my main point was that itertools is handy for manipulating sequences, even if you aren't exploiting its capacity for lazy evaluation. Cheers, Nick. -- Nick Coghlan | ncoghlan at email.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net
- Previous message (by thread): Recursive list comprehension
- Next message (by thread): Recursive list comprehension
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list