else in list comp
Greg Ewing (using news.cis.dfn.de)
me at privacy.net
Wed Jan 29 21:01:21 EST 2003
More information about the Python-list mailing list
Wed Jan 29 21:01:21 EST 2003
- Previous message (by thread): else in list comp
- Next message (by thread): else in list comp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Cliff Wells wrote: > What I thought of first: > > ['' for i in l if i is None else i] > > Any thoughts on something like this? I don't think you've thought this through properly. Consider that a list comp can have multiple if and/or for clauses interspersed. How would your proposed feature work in the general case? Also, you need to understand that an if clause in a list comp decides *whether* to include an item in the list; it doesn't decide *what* to include in the list. Given that, I can't see that attaching an else clause to it makes any sense. Greg
- Previous message (by thread): else in list comp
- Next message (by thread): else in list comp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list