[Tutor] Another assert() question

Alan Gauld alan.gauld at btinternet.com
Mon Jul 14 09:51:28 CEST 2008


"Dick Moores" <rdm at rcblue.com> wrote

>>5.10 Boolean operations
>>....
>>"In the context of Boolean operations, and also when expressions are 
>>used by control flow statements, the following values are 
>>interpreted as false: |False|, |None|, numeric zero of all types, 
>>and empty strings and containers (including strings, tuples, lists, 
>>dictionaries, sets and frozensets). All other values are interpreted 
>>as true."

> I'll presumptuously, brazenly go further: I have 2 quarrels with 
> 5.10:
> 1. "interpret" is misleading. Revise, substituting "consider".
> 2. "value" is misleading. Revise, substituting "truth value".

I wouldn't argue with your complaint on 'value' but it seems to me 
that
interpret is exactly the ruight word fopr two reasons:
1) The action is performed by the Python interpreter so technically
    it is being interpreted, and

2) interpretation is a more or less mechanical process. 'Consider'
    implies some measure of intelligence. Computers are machines
    and devoid of intelligence therefore the more mechanistic
    'interpret' is the appropriate term.

Basically it is just an arbitrary rule that the interpretation engine
follows. Different compilers/interpreters use different rules. This
happens to be Pythons interpretation.

Alan G 




More information about the Tutor mailing list