Hacker News new | ask | show | jobs
by more-coffee 1956 days ago
I always have been and always will be against the walrus operator. I don't care how much anyone tries me to sell it on its elegance. There's just no _need_. It's already the #1 example of wtfpython https://github.com/satwikkansal/wtfpython#-first-things-firs...

/rant. Those kind of features are going to keep coming anyway, I'm afraid.

2 comments

It's the #1 example of wtfpython for no good reason.

It's like someone used to PHP or JS style coercion, doing: 1 + "2", getting a type error and asking "wtf python?".

The walrus operator is obvious, and very handy in many cases.

The capture part of the pattern matching PEP, on the other hand, has been designed shodilly.

I don’t like the walrus operator personally, but wtfpython has it wrong. It’s simply syntax for an expression that includes a binding. It parses like any other expression, and is completely unsurprising.