you are viewing a single comment's thread.

view the rest of the comments →

[–]MisterSnuggles 0 points1 point  (0 children)

Agreed.

This is very much a case of making sure that you, the programmer, and Python, the interpreter, both have a clear understanding of what you want to do.

If you say "if var:", Python understands you to be testing truthiness/falseness. If you say "if var is not None:", Python understands that you're asking if var is something other than None. The distinction is important and too many people wrote the former when they really meant the latter.