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.

Python has a boolean type.

> That means, never assume that arbitrary values
> can be interpreted as true or false,

There's nothing to assume, and nothing arbitrary in it. It's all clearly
defined in whole letters in the language references.

> always put in an explicit comparison
> if necessary so it's obvious the expression is a Boolean.

The fact that the expression is used in the context of a if statement is
clearly enough to denote a boolean expression. Explicitly testing
against a boolean is uselessly redundant - and doesn't change anything,
since it's always a boolean expression. FWIW, getting rid of theses
"explicit" redundant tests was one of the first things I learned about
programming.


-- 
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

Reply via email to