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

Fredrik Lundh fredrik at pythonware.com
Tue Jul 15 23:13:30 CEST 2008

Jerry Hill wrote:

> This is just plain untrue.  If 'name is None' evaluates to true, then
> the variable 'name' is bound to the singleton value None.  It has
> nothing to do with allocated memory or null pointers.  All it means is
> that someplace along the line you did the equivalent of 'name = None'
> in your code.

On the other hand, there's nothing that keeps a Python implementation 
from using NULL to represent the None value.


More information about the Python-list mailing list