PEP 572: Fix example so it actually works
This commit is contained in:
parent
2cd3526738
commit
325476b1b7
|
@ -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)]
|
||||
|
|
Loading…
Reference in New Issue