Hacker News new | ask | show | jobs
by pjmlp 483 days ago
In a way Python is a bad Lisp, still looking forward that catches up in native code compilation and multiline lambdas.

Could be better, but that is what mainstream gets.

1 comments

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

:)