True == 1 weirdness

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Sep 17 14:29:46 CEST 2015


On Thu, 17 Sep 2015 02:10:44 -0400, Random832 wrote:

> On Wed, Sep 16, 2015, at 21:25, Steven D'Aprano wrote:
>> So what? The intended purpose of `is` and `==` is not to return True.
>> It is
>> to perform a comparison which may return False, or True.
> 
> Yeah, but there's no point in doing a comparison unless you're doing it
> in a context where it *might* return true. Semantics matter.

Have we all suddenly suffered a mass outbreak of early onset Alzheimer's 
Disease? :-) How about the most common use of `is` of all?

    if some_object is None: ...

Next thing we know, people will be claiming that => is an operator *wink*


-- 
Steven D'Aprano


More information about the Python-list mailing list