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 works: <geshi lang="python"> if not bool(user):
gologin()
</geshi>
As does: <geshi lang="python"> if user == None:
gologin()
</geshi>
But this is probably best: <geshi lang="python"> if user is None:
gologin()
</geshi>
This article "what exactly is "None"" helped explain this a little better.