'while' in list comprehension?
Alex Martelli
aleax at aleax.it
Thu Nov 13 11:49:07 EST 2003
More information about the Python-list mailing list
Thu Nov 13 11:49:07 EST 2003
- Previous message (by thread): 'while' in list comprehension?
- Next message (by thread): ModPython and embedding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing (using news.cis.dfn.de) wrote: > Hannu Kankaanp?? wrote: >> Another variation: >> >> foo = [i for i in bar, break if len(i) == 0] >> >> This wouldn't need a new keyword. > > My thoughts on all this are that if you want to do > something that procedural, it would be better written > out as nested statements. List comprehensions are > meant to be read declaratively. Yes, they are. Still, [ i for i in bar while len(i) ] DOES read pretty declaratively to me (while the "break" version admittedly doesn't). Alex
- Previous message (by thread): 'while' in list comprehension?
- Next message (by thread): ModPython and embedding
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list