19

Was so confused what the new walrus operator did. Why don't the docs give a simple comparison example like this?

Comments
  • 0
    Afaik it's just like C/C++'s assignment operator, right?
  • 1
    Isn't it an assignment operator, like in pascal?
  • 9
    It's an assignment which also returns the value as result of the expression, rather than being only a statement.
  • 1
    @gitreflog AFAI (used to) K, Python already did this which I was confused. Don't most languages do this as default behavior?
  • 3
    An assignment that also is operable on without a new line?

    shit dude i could shrink a bunch of my shit with this
Add Comment