Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Compare to None

📅 2009-Sep-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ comparisons, none, python ⬩ 📚 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


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧