[Python-Dev] Adding a conditional expression in Py3.0
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Wed Sep 21 09:17:23 CEST 2005
More information about the Python-Dev mailing list
Wed Sep 21 09:17:23 CEST 2005
- Previous message: [Python-Dev] Adding a conditional expression in Py3.0
- Next message: [Python-Dev] Adding a conditional expression in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jason Orendorff wrote: > Honestly, I think I would prefer this syntax. Examples from real > code, before and after: > > lines = [line for line in pr.block.body > if line.logical_line.strip() != ''] > lines = [for line in pr.block.body: > if line.logical_line.strip() != '': > line] > > row.values = \ > [line[col.start:col.end].strip() for col in columns] > row.values = \ > [for col in columns: line[col.start:col.end].rstrip()] > > return [p for p in self.listdir(pattern) if p.isdir()] > return [for p in self.listdir(pattern): if p.isdir(): p] -1. Too much similarity with the for/if statement. People would say "why can we put a for statement in brackets but not a try statement". Reinhold -- Mail address is perfectly valid!
- Previous message: [Python-Dev] Adding a conditional expression in Py3.0
- Next message: [Python-Dev] Adding a conditional expression in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list