Coding style

Donn Cave donn at u.washington.edu
Wed Jul 19 16:45:22 EDT 2006


In article <e9ksvr$g8u$1 at news.albasani.net>,
 Georg Brandl <g.brandl-nospam at gmx.net> wrote:
> Lawrence D'Oliveiro wrote:

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

I don't know whether she would welcome this or not, but here
I provide an archive link to a classic post by Laura Creighton
on this matter:

http://groups.google.com/group/comp.lang.python/msg/2de5e1c8384c0360

It's lengthy but very readable, and for me it has that quality of
exposition where you feel at first reading as though you had
already known all that -- even if you really hadn't.

But I don't know where she is today, or the Python she was
writing about.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list