PEP 572: Fix example so it actually works

This commit is contained in:
Chris Angelico 2018-03-01 02:07:07 +11:00
parent 2cd3526738
commit 325476b1b7
1 changed files with 2 additions and 2 deletions

View File

@ -55,8 +55,8 @@ These list comprehensions are all approximately equivalent::
stuff = [[f(x), x/f(x)] for x in range(5)]
# External helper function
def pair(value): return [value, x/value]
stuff = [pair(f(x)) for x in range(5)]
def pair(x, value): return [value, x/value]
stuff = [pair(x, f(x)) for x in range(5)]
# Inline helper function
stuff = [(lambda y: [y,x/y])(f(x)) for x in range(5)]