'if name is not None:' v. 'if name:'

Jeffrey Froman jeffrey at fro.man
Tue Jul 15 21:50:50 CEST 2008

Victor Noagbodji wrote:

> Why do people use if name is not None: instead of simply
> writing if not name?

To differentiate from the case where name == '', or some other non-None
false value. So the question is, do you want to test for identity with
None, or for truth in general?


More information about the Python-list mailing list