3 ms·
Is there some way of simulating expression-based "let" in Python? Without that lambdas are very weak.
by tome 7y ago
Is there some way of simulating expression-based "let" in Python? Without that lambdas are very weak.
- gilch 7y agoRecall that Python has assignment expressions `:=` now: https://www.python.org/dev/peps/pep-0572/ https://www.python.org/dev/peps/pep-0572/ Even before that, I had a "let" in Drython: https://github.com/gilch/drython/blob/master/drython/statement.py#L810 https://github.com/gilch/drython/blob/master/drython/stateme... In Haskell let and lambda have a subtle distinction due to the type system, but in Lisp and dynamically typed languages like Python, "let" can simply be lambda definition that is called immediately.