I'm asking this because I know that the pythonic way to check whether a list is empty or not is the following:
my_list = []
if not my_list:
print "computer says no"
else:
# my_list isn't empty
print "computer says yes"
will print computer says no
, etc. So this leads me to identify []
with False
truth-values; however, if I try to compare [] and False "directly", I obtain the following:
>>> my_list == False
False
>>> my_list is False
False
>>> [] == False
False
etc...
What's going on here? I feel like I'm missing something really obvious.