checking if a list is empty

Terry Reedy tjreedy at udel.edu
Sun May 15 21:57:39 EDT 2011


On 5/15/2011 5:36 PM, Terry Reedy wrote:
> On 5/15/2011 1:33 PM, rusi wrote:

>> Dijkstra's writings I alluded to,

at
http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html

"Acquiring that familiarity requires what in these financial times is 
known as "intellectual investment"; you can take my word for it that 
this investment quickly pays off."

I recommend understanding the following as three more "intellectual 
investments":

We create a Boolean domain by drawing a distinction in some domain and 
treating everything on each side of the distinction as equal in some 
value. A Boolean value or variable represents such a dichotomy, a choice 
between two all-inclusive but mutually exclusive possibilities. Boole 
derived his domain from truth/falsity of propositions. But that is an 
interpretation of his abstract model and only one of endless possibilities.

This realization that switching networks are another interpretation is 
the basis of digital computation. Boolean algebra theorems are theorems 
about switching networks and can be used to design such networks. Such 
networks can be used to do boolean arithmetic. The trick is to coerce 
physical components into one of two states. Part of the trick is to not 
look when they are transiting between them.

For its built-in information objects, Python choose 'representation of 
something' versus 'representation of nothing' as the dichotomy. It 
matches 'something' to True and 'nothing' to False as this is generally 
more useful than the opposite matching. In boolean contexts, it 
automatically fetches the boolean value of an object.

-- 
Terry Jan Reedy




More information about the Python-list mailing list