testing for valid reference: obj vs. None!=obs vs. obj is not None

alf ask at me
Sat Dec 9 00:00:26 EST 2006


alf wrote:
> Hi,
> 
> I have a reference to certain objects. What is the most pythonic way to 
> test for valid reference:
> 
>     if obj:
> 
>     if None!=obs:
> 
>     if obj is not None:
> 
thx for all answers - now "if obj is not None:" in an obvious choice ...



More information about the Python-list mailing list