def does_nothing():
a = 1
def does_not_do_anything():
return None
result1 = does_nothing()
print repr(result1), ": does_nothing"
result2 = does_not_do_anything()
print repr(result2), ": does_not_do_anything"
def table_row(value, empty=False):
spaces = 15
formater = "{value!r: ^{spaces}}|{for_cmp: ^{spaces}}|{for_is: ^{spaces}}"
if empty:
print formater.format(
value="Value",
for_cmp="==",
for_is="is",
spaces=spaces
)
print '-' * (spaces * 3 + 2)
return
print formater.format(
value=value,
for_cmp=(value == None),
for_is=(value is None),
spaces=spaces
)
return
# Let's make a table to compare what values are could be equaled to None
table_row(None, True)
table_row(None)
table_row(True)
table_row(False)
table_row(0)
table_row(1)
table_row('')
table_row('string')
table_row(NotImplemented)
table_row(Ellipsis)
print
if None:
print "That could not be True!"
else:
print "Either False!"