using Booleans numerically : Boolean « Data Type « Python Tutorial






foo = 42
bar = foo < 100
print bar
print bar + 100
print '%s' % bar
print '%d' % bar








2.1.Boolean
2.1.1.true and false value
2.1.2.Python accepted almost anything in a boolean context
2.1.3.The following are defined as having false values in Python
2.1.4.using Booleans numerically