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

Jerry Hill malaclypse2 at gmail.com
Tue Jul 15 16:32:15 EDT 2008


On Tue, Jul 15, 2008 at 4:13 PM, Reedick, Andrew <jr9445 at att.com> wrote:
> If name is None:
>    Then name is NULL, nothing, nada, no object, no memory allocated, a
> NULL pointer

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.

-- 
Jerry



More information about the Python-list mailing list