conditional expressions

Lulu of the Lotus-Eaters mertz at
Mon Sep 23 14:18:47 EDT 2002

"Delaney, Timothy" <tdelaney at> wrote previously:
|This type of thinking is one very good reason why bool() is a Good Thing
|(TM). A large number (my guess is the majority) of Python users do not know
|about operator.truth().

Well...  Python users won't necessarily innately know about bool() when
it is available in 2.3 (or 2.2.x).  In either case, users will gain the
knowledge from documentation/discussion.  While I'm not against the new
boolean type, or built-in bool(), it's not impossible simply to let
users know they can write:

    from operator import truth as bool

at the top of their module.

For that matter, they could also write:

    bool = lambda x: not not x

if you really wanted to save 8 characters :-).

Yours, Lulu...

 mertz@  _/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: \_\_\_\_    n o
gnosis  _/_/             Postmodern Enterprises            \_\_
.cx    _/_/                                                 \_\_  d o
      _/_/_/ IN A WORLD W/O WALLS, THERE WOULD BE NO GATES \_\_\_ z e

More information about the Python-list mailing list