Python will implicitly convert any object to a Boolean value for testing, so use it wherever possible.
# Good examples, using implicit truth testing
if attr:
# do something
if not attr:
# do something
# Bad examples, using specific types
if attr == 1:
# do something
if att...