Skip to content

Instantly share code, notes, and snippets.

@divs1210 divs1210/multilambda.py
Last active Nov 3, 2018

Embed
What would you like to do?
Dead Simple Multiline Lambdas for Python
def do(*body):
return body[-1]
# Example (Python 2)
# =======
map(lambda x: do(
print('x =', x),
x * x),
range(5))
"""
x = 0
x = 1
x = 2
x = 3
x = 4
[0, 1, 4, 9, 16]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.