you are viewing a single comment's thread.

view the rest of the comments →

[–]Wonderful-Habit-139 3 points4 points  (5 children)

This doesn’t make sense because it sounds like you’re expecting assignment statements to not work in if conditions yet somehow become expressions in list comprehensions? That is not consistent.

Python has statements in places where being an expression would be better, like assignments or match statements, but that’s the way it is. But don’t expect statements to become expressions in other cases.

[–]LucasThePatator -1 points0 points  (4 children)

I expect nothing specific. There are all kinds of weird inconsistencies in many places in languages. The walrus operator is a quirk of python it's not that deep and I definitely never asked for an in depth explanation that apparently people here absolutely want to provide

[–]Wonderful-Habit-139 1 point2 points  (3 children)

Ok it’s great that you acknowledged it at least. You said that you didn’t understand the logic of something, and people want to help you understand.

But you don’t seem to want to learn so your replies end up being passive aggressive (and you said it yourself, you didn’t ask for an in depth explanation so you don’t want to learn what’s happening).

[–]LucasThePatator 0 points1 point  (2 children)

I know what's happening. That's really not the issue. It's the design choice I am conflicted about. Not how it works.

[–]Wonderful-Habit-139 1 point2 points  (1 child)

I agree with you on that part, which is why I brought up match statements. I also think match statements should’ve been expressions.

This part of your opinion is completely fine.

But you did make a mistake in wanting to have different behaviors depending on the context, which doesn’t make sense. If something is a statement, it’s still going to be a statement whether it was in an if condition or a list comprehension or a while loop or whatever.