In message <[EMAIL PROTECTED]>, Georg Brandl wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Bob Greschke >> wrote: >> >>> I'd go even one step further. Turn it into English (or your favorite >>> non-computer language): >>> >>> 1. While list, pop. >>> >>> 2. While the length of the list is greater than 0, pop. >>> >>> Which one makes more sense? Guess which one I like. CPU cycles be >>> damned. >>> :) >> >> One of my rules is, always program like the language actually has a >> Boolean type, even if it doesn't. That means, never assume that arbitrary >> values can be interpreted as true or false, always put in an explicit >> comparison if necessary so it's obvious the expression is a Boolean. > > You can do that, but it's not considered Pythonic. And it might be > ineffective. > > Other than in PHP, Python has clear rules when an object of a builtin type > is considered false (i.e. when it's empty). So why not take advantage of > this?
Because the clearest rule of all is that True is true, and False is false, and that's all I want to have to remember. -- http://mail.python.org/mailman/listinfo/python-list