As a common misconception, a ||= b
is not equivalent to a = a || b
, but it behaves like a || a = b
.
But here comes a tricky case. If a
is not defined, a || a = 42
raises NameError
, while a ||= 42
returns 42
. So, they don't seem to be equivalent expressions.