while true: !!!

Steve Holden sholden at holdenweb.com
Thu Dec 21 08:36:13 EST 2000


Greg Ewing <greg at cosc.canterbury.ac.nz> wrote in message
news:3A41539E.DF6977D6 at cosc.canterbury.ac.nz...
> gbreed at cix.compulink.co.uk wrote:
> >
> > Take any type, and if
> > there's a way of it being nothing, it evaluates false.
>
> Hmmm, let's try that out. Is [[]] true or false?
> It's a list containing a list containing nothing.
> Since [] is false, a list containing nothing must be
> nothing. So [[]] is a list containing nothing,
> which is nothing. Ah, it must be false! :-)
>
> Nothing-is-weird-stuff,
>
if [[]]:
    print "Ewing is wrong"
else:
    print "Ewing is right"

Ewing is wrong

> --
> Greg Ewing, Computer Science Dept, University of Canterbury,
> Christchurch, New Zealand
> To get my email address, please visit my web page:
> http://www.cosc.canterbury.ac.nz/~greg
>
Clearly your sophistry does not suffice to fool the interpreter, which
obviously "knows" that [[]] is not nothing, but a list containing a list
containing nothing.

if-you-wrap-nothing-up-you've-got-something-ly y'rs  - steve







More information about the Python-list mailing list