"Victor Noagbodji" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Well that's exactly why I'm asking. Since None returns False in if > statements. Why do people use if name is not None: instead of simply > writing if not name? >
Because '' is a string value that is treated as false. If name=='', then "if name:" will be false, but "if name is not None:" will be true. Which one to use depends entirely on how you want to treat empty strings. For all other (string) values of name, the two statements will give the same results. Russ -- http://mail.python.org/mailman/listinfo/python-list