Re: while var, but var ==16 != true

2008-07-14 Thread John Machin
On Jul 14, 3:32 pm, Tim Roberts [EMAIL PROTECTED] wrote: 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

Re: while var, but var ==16 != true

2008-07-14 Thread [EMAIL PROTECTED]
On 14 juil, 07:32, Tim Roberts [EMAIL PROTECTED] wrote: (snip) 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. Unless the author of the class

Re: while var, but var ==16 != true

2008-07-14 Thread Jeffrey Froman
Tim Roberts wrote: 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. Empty set objects also evaluate as false in a boolean context. Jeffrey --

while var, but var ==16 != true

2008-07-13 Thread maestro
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. p=16 p 16 while p: print p p -= 1 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 i can also do: k=[] while k: k.pop()

Re: while var, but var ==16 != true

2008-07-13 Thread Tim Roberts
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), []