4 ms·
> It is in fact extremely surprising that an expression does something different based on surrounding context It isn't doing anything different though. Compare
by Doxin 6y ago
> It is in fact extremely surprising that an expression does something different based on surrounding context
It isn't doing anything different though. Compare:
>>> a:=1
1
>>> (1, 2)
(1, 2)
>>> (a:=1, 2)
(1, 2)
The thing that's confusing people here isn't even the walrus operator, it's tuple syntax.
> If your idea is that an operator is free to do whatever, once it's outside its predicted situation
No it's not. But clearly an operator can never do an operation it isn't defined to do. is and == are different operators and they do different things.
> I think if you think that some of those examples have no legitimate uses at all
They do have legitimate uses, but purposefully obfuscating the context around what the code is doing is hardly the fault of the language.
> I also do not see how this is anti-python, I think you are being unfair to the author.
Yeah on further thought it really isn't anti-python, but articles like the OP do tend to get linked in anti-language posts, which is probably what got me a bit annoyed about the article. No fault of the author.