How can I test if a reference is null ?

Greg Ewing (using news.cis.dfn.de) me at privacy.net
Thu Mar 27 19:07:36 EST 2003


Alex Martelli wrote:
> cudjoe wrote:
>>I know that there are no types in python, but how can we test if a
>>variable is empty ?
> 
> 
> I believe the test you want is
> 
>     if icon is not None:

Just as an aside, there isn't really a true equivalent
of NULL in Python -- all references always point at
*some* object. None happens to be a built-in object
provided for references to point at when they don't
want to point to anything else.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list