Python Programming Learning Circle
Feb 5, 2020 · Fundamentals
Why ‘if x is not None’ Beats ‘if not x’ in Python: Avoid Hidden Bugs
This article explains the three common ways to test for None in Python, reveals how using "if not x" can mistakenly treat other falsy values as None, and recommends the clear and safe "if x is not None" style endorsed by Google.
best-practicescode styleconditional
0 likes · 3 min read