question of style

Lie Ryan lie.1296 at
Sun Jul 5 12:43:35 EDT 2009

Steven D'Aprano wrote:
> On Sun, 05 Jul 2009 11:37:49 +0000, Lie Ryan wrote:
>> Neither python's `if` nor `if` in formal logic is about testing True vs.
>> False. `if` in python and formal logic receives a statement. The
>> statement must be evaluatable to True or False, but does not have to be
>> True or False themselves. It just happens that True evaluates to True
>> and False evaluates to False.
> I think your explanation is a little confused, or at least confusing.

Indeed, partially because I said "statement" when I really meant

> Other languages don't require specific enumerable values, and instead 
> accept (e.g.) any integer, or any object, with rules for how to interpret 
> such values in such a context. 

That was what I was wanting to say, except that I stretched that to
formal logic (mathematical logic). Even in formal logic `if` receives
any arbitrary expression that can be -- according to certain rules --
interpreted as True or False (i.e. the expressions themselves are not
required to be a boolean value).

The conclusion is python's `if` does not deviate from `if`'s semantic in
mathematical sense.

More information about the Python-list mailing list