Skip to content

Instantly share code, notes, and snippets.

@divs1210
Last active September 14, 2022 18:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divs1210/685cb671d38bff0304b8591fe0ef640a to your computer and use it in GitHub Desktop.
Save divs1210/685cb671d38bff0304b8591fe0ef640a to your computer and use it in GitHub Desktop.
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