2 ms·
We can sort of make a shitty multi-line lambda in Python by making a dummy function called progn, and using it, like this: >>> def progn(*args): ... if a
by kazinator 2y ago
We can sort of make a shitty multi-line lambda in Python by making a dummy function called progn, and using it, like this:
>>> def progn(*args):
... if args:
... return args[-1]
... else:
... return None
...
>>> fun = lambda x : progn(print('abc'),
... print(x),
... print('def'))
>>>
>>> fun(42)
abc
42
def
:)