Tom Ritchford
1 min readApr 20, 2020

--

As you point out in your footnote, this is not guaranteed and “only” in fact true of all CPython implementations to date. “Only” is a somewhat funny word there, because I believe that 99% of Python programmers never use any interpreter other than CPython for anything other than experimentation.

When I first started writing Python, I took advantage of this feature by writing things like if a is 1: instead of if a == 1:.

Finally some kind code reviewer pointed out that this was not just an implementation details, but could lead to error in later maintenance if e.g. it were changed to if a == 257:. I realized the error of my ways and never did it again, but I wonder if that early code still exists somewhere and people snigger when they see it…

Thanks for an excellent article!

--

--

No responses yet