How can I test if a reference is null ?

Greg Ewing (using me at
Fri Mar 28 01:07:36 CET 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

More information about the Python-list mailing list