Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Compare to None

📅 2009-Sep-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

retVal = fooBar() # Function that can return None if retVal: # Wrong way to compare for None if retVal is None: # Correct if retVal is not None: # Correct