tac-tics wrote: > dwelch91 wrote: > >>tac-tics wrote: >> >>>I'd say the second one. Empty lists are not false. They are empty. Long >>>live dedicated boolean data types. >>> >> >>Uh, no, empty lists are False in a boolean context: >> >>http://docs.python.org/lib/truth.html >> >>-Don > > > Perhaps I should have specified it like this: > > >>>>empty_list = [] >>>>empty_list is not False > > True
Physical identity is not structural equality. > I'm well aware that both of these snippets does the same thing. I'm > just spouting my opinion that lists and integers are not tests, and in > an ideal world (Java??? X-) You naughty troll > if statements support only boolean types. if statements supports only boolean *expressions*. An expression is boolean if it's result can be coerced to a boolean value, ie fed to the bool type's constructor. So your example is wrong wrt/ if statements - it should read: empty_list = [] bool(empty_list) is False => True -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])" -- http://mail.python.org/mailman/listinfo/python-list