It's certainly a contrived example. Actual code with such a mistake is generally far more subtle.
Wes, sorry, but I really don't follow what you're saying. For example,
[Wes Turner <email@example.com>]
> Do not do this:
> x = 2
> if (x == 3) or (x := 3):
> What do we call that mistake?
It displays 3 - while it appears to be silly code, there's nothing
about it that's undefined. So I fail to see how showing that example
anywhere would do anyone any good.
You can do the same kind of thing today via, e.g.,
def __init__(self, value):
def bind(self, value):
self.value = value
def __eq__(self, other):
return self.value == other
>>> x = Bindable(2)
>>> if x == 3 or x.bind(3):
And I wouldn't put that example anywhere in any docs either ;-)