Python Tips
Python takes some getting used to. The clean syntax is great, but it has some things which a Java or Ruby programmer might not guess.
How to tell if an object is None
This won't parse: <geshi lang="python"> user = users.get_current_user() if !user:
gologin()
</geshi>
This parses but doesn't work: <geshi lang="python"> user = users.get_current_user() if not user:
gologin()
</geshi>
This works! <geshi lang="python"> user = users.get_current_user() if user is None:
gologin()
</geshi>