explicit is better, BUT... (was Re: PEP 285: Adding a bool type)

Alex Martelli aleax at aleax.it
Thu Apr 11 04:48:28 EDT 2002


Huaiyu Zhu wrote:
        ...
> I don't see any situation that you need "if bool(some_expression)".

Right, it's just as redundant as:

    for item in iter(some_iterable):

or

    print str(some_expression)


I.e., if or while intrinsically use bool, just like for uses iter and
print uses str.  Now, what we need is a release 1.0.1 of this.py
that, right below "explicit is better than implicit", adds a
"but-clause" of (I suggest) "but superfluous redundancy and
repetitive boilerplate aren't" (self-referential, of course:-).
Note this also helps ward against "if bool(x)==True:" &c...


Alex




More information about the Python-list mailing list