| |
comp.lang.python |
>>>> 0 == False >But, I know I can use [] to represent False as in >>>> if not []: print 'empty' >But then doing the following gives a surprising (to me!) result >>>> [] == False >Could anybody point out why this is the case? As a general rule, I've found code like "if x == False" to be a bad idea in
>This is a slightly naive question, but I know that 0 can be used to
>represent False. So
>True
>...
>empty
>False
happen to evaluate to a false value in a Boolean context, but they are not
all the same.
ANY language.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.