In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > tac-tics wrote: ... >> I'd say the second one. Empty lists are not false. They are empty. >> Long live dedicated boolean data types.
> Take them off to where they belong! Tac-tics is right, an empty list is not False. Anyway, just for some variety, I think (2) is preferrable to (1), as is the following while 1: try: lst.pop() except IndexError: break Rather than blindly apply familiar patterns to our work, I think everyone would agree that coding style in matters like this should follow the underlying point of the code. In this case, the body of the test refers implicitly to the length of the list, since .pop() -> (list[a], list[:a]) where a is (len(list) - 1) It's therefore quite appropriate for the test to be length. Donn Cave, [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list