maestro <[EMAIL PROTECTED]> wrote:
>
>why does this work?  "while p" = "while p != 0" ? 1 is True and 0 is
>false in python but other numbers have no boolean value so why doesnt
>it abort.

Because your statement is incorrect.  Everything has a boolean value in
Python.  0, None, False, '' (empty string), [] (empty list), () (empty
tuple), and {} (empty dictionary) all have a False value.  Everything else
has a True value.

Python didn't even have a boolean type (True and False) until rather
recently (2.2?). 

This is a very handy feature, and it's one of the things I love about
Python.

>so obv while var means while not empty or why not zero but it isnt
>something youd guess unless youd beeen shown it.

It's clearly stated in the documentation.  I don't know how you concluded
that True and False were the only boolean values.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to