True == 1 weirdness

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Sep 16 22:38:30 CEST 2015


On 16/09/2015 18:41, Sven R. Kunze wrote:
> On 16.09.2015 19:33, Steven D'Aprano wrote:
>> On Thu, 17 Sep 2015 01:40 am, Random832 wrote:
>>
>>> "in" suggests a relationship between objects of different types (X and
>>> "something that can contain X") - all the other comparison operators are
>>> meant to work on objects of the same or similar types.
>> `is` and the equality operators are intended to work on arbitrary
>> objects,
>> as are their inverses `is not` and inequality.
>>
>> And with operator overloading, < <=  > and => could have any meaning you
>> like:
>>
>> graph = a => b => c <= d <= e
>>
>
> Sorry? What are you trying to do here?
>

Typo I'd hazard a guess at, should be graph = a >= b >= c <= d <= e

Assuming that I'm correct, graph is True if a is greater than or equal 
to b and b is greater than equal to c and c is less than or equal to d 
and d is less than or equal to e else False.  So where is the problem?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list