Coding style

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Jul 18 02:46:24 EDT 2006


In message <Q8OdnfqZn6udnSHZnZ2dnUVZ_vOdnZ2d at nmt.edu>, 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.



More information about the Python-list mailing list