alf <[EMAIL PROTECTED]> writes:
> I have a reference to certain objects. What is the most pythonic way
> to test for valid reference:

If you're intending to use None as a sentinel for an invalid reference,
then use
>       if obj is not None:

You could also make a unique sentinel:

       Sentinel = object()
       ...
       if obj is not Sentinel:  ...

"if obj" isn't necessarily what you want; obj might be a valid but
empty container.

"if obj != None" is also wrong, for reasons someone else explained.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to