Python while loop

Hello, 
I had a question about the python while loop
I was doing quicktest to practice my python syntax and I ran into this one.

def num_digits(n):
    count = 0
    while n:
        print n
        count += 1
        n = n / 10
    return count

 It seems like python interpret
while n:
as
while n != 0:

Now I couldn't find anything in the python doc about this default behavior.

Similar to mel interpreting

if(getAttr ($myObj+".visibility"))

for 

if(getAttr ($myObj+".visibility")==1) by default.

Anyone can tell me if its a known fact and maybe point me to some docs, or just say from personal experience.
Thanks !

In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: False,None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true. 

source: http://docs.python.org/reference/expressions.html#boolean-operations

good thing too as it would have been a infinite loop otherwise.

Anyway same in mel its not thet it interprets it as == 1 ist just that 0 is considered false, and all other numeric values as true. Pretty common design in scripting languages in general IMHO.