Hacker News new | ask | show | jobs
by satiric 925 days ago
I'm no python expert, but if python really has a way to define named functions inside an expression, I'm not sure I want to know how to do it...
2 comments

If you haven't been keeping up with recent Python changes...

For Python 3.8, the biggest change is the addition of assignment expressions. Specifically, the := operator gives you a new syntax for assigning variables in the middle of expressions. This operator is colloquially known as the walrus operator.

From: https://realpython.com/python-walrus-operator/

Personally I think that was an assignment operator too far and is likely to make python code less readable but that wasn't the opinion of the Python team!

I tried using the walrus, but it wasn’t accepted.
i tried a lambda but not sure if it worked, so i gave up
Walrus!