Test None for an object that does not implement ==

Devin Jeanpierre jeanpierreda at gmail.com
Sun Dec 25 19:58:14 EST 2011


> Which of course leads to a SillyPEP for a new keyword, "are", which
> would allow you to write:
>
>>>> a and c are None
>
> instead of the much more verbose
>
>>>> a is None and c is None

How about:

    >>> a is b is None

;)

-- Devin

On Sun, Dec 25, 2011 at 7:27 PM, Roy Smith <roy at panix.com> wrote:
> In article <mailman.4082.1324858055.27778.python-list at python.org>,
>  Devin Jeanpierre <jeanpierreda at gmail.com> wrote:
>
>> The issue here is that "== None" is being used instead of "is None",
>> but I believe that's been covered. Your response doesn't include it,
>> so maybe it's worth restating.
>
> Which of course leads to a SillyPEP for a new keyword, "are", which
> would allow you to write:
>
>>>> a and c are None
>
> instead of the much more verbose
>
>>>> a is None and c is None
> --
> http://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list