checking if a list is empty

rusi rustompmody at gmail.com
Fri May 13 06:58:44 EDT 2011


On May 13, 1:02 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Thu, May 12, 2011 at 11:46 PM, rusi <rustompm... at gmail.com> wrote:
>
> > The boolean domain is only a 100 years old.
> > Unsurprisingly it is not quite 'first-class' yet: See
>
> It is nowadays. Every halfway-mainstream language I can think of has
> an explicit boolean datatype.

I guess you did not quite see my 'quite' -- which itself is a
summarization of Dijkstra's "officially" vs "in practice" ? [Heres the
quote]


> >http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1070.html
> > [Lifted fromhttp://c2.com/cgi/wiki?EqualVsTrueFalse]
>
> > ----------------------------
> > "In retrospect, one might be tempted to regard the introduction of
> > something as simple as the boolean domain as a minor invention, but I
> > think that that would be a grave mistake: it is a great invention
> > because, being so simple, it is such a powerful simplifier. It is of
> > the same level as the introduction of natural numbers, which enabled
> > us to add 3 to 5, regardless of whether we are adding apples or
> > pears."
>
> > "George Boole made a radical invention, so radical, in fact, that now,
> > more than a century later, the scientific community has not absorbed
> > it yet. (To stay with the metaphor: officially, boolean expressions
> > may have reached the status of first-class citizens, in practice —
> > because old habits and prejudices die hard— they are still the victims
> > of discrimination.) Let me give you a few examples."
>
> > "In the programming language FORTRAN, as conceived a century after
> > Boole published his invention, boolean expressions are allowed, but
> > there are no boolean variables! Their introduction into programming
> > had to wait until the design of ALGOL 60."


As an analogy, in Perl, a list can get coerced to its length "... when
in scalar context.." or something like that.  Most programmers from
the static-typechecked-languages camp would balk at that laissez faire
attitude.  Likewise Harris is pointing out that noob python
programmers may feel a bit unnerved by non-boolean types unexpectedly
showing 'boolean-ness.'  Maybe we are just more in noob category and
we've not got the zen of python?? Dunno...



More information about the Python-list mailing list