[Python-ideas] Assignments in list/generator expressions
Nick Coghlan
ncoghlan at gmail.com
Mon Apr 11 05:00:09 CEST 2011
On Mon, Apr 11, 2011 at 12:58 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> def _build_sequence(xs):
> ys = []
> for x in xs:
> y = f(x):
> if y:
> ys.append(y)
> return ys
> ys = _build_sequence(xs)
Oops, random colon slipped in as typo. That should be:
def _build_sequence(xs):
ys = []
for x in xs:
y = f(x)
if y:
ys.append(y)
return ys
ys = _build_sequence(xs)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-ideas
mailing list