[Tutor] Question about the use of None

Wilfred Y wilfred_y2003 at yahoo.com.sg
Fri Jun 11 10:57:07 EDT 2004

Hi,I came across this keyword None. The document I read says "None is python's way of representing nothing. It evaluates to False when treated as a condition"So I assume, if I do start=None, then it's as good as saying start="" or start=0Now, the code to represent it's use is pretty confusing. It goes like this:start=Nonewhile start != ""     start=raw_input("Press enter to exit, or key in a string: ")The confusing part is here, since start = "", then it should never be able to go into the while loop.  (Well, at least that's if None is really == "")So to check, I tried this in the interactive window:start=Noneprint startand presto !! It prinst the string None, even though i haven't placed it in double quotes. So it seems None does have a value, which explains why it managed to enter the while loop. Is this correct ? Hope someone can help with an explanation. Thanks in advance folks !!-Wil
 Yahoo! Mobile
- Download the latest ringtones, games, and more!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040611/9186ba41/attachment.html

More information about the Tutor mailing list