True == 1 weirdness
Sven R. Kunze
srkunze at mail.de
Wed Sep 16 13:41:21 EDT 2015
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?
>> Why not make isinstance a comparison operator and have "1 instanceof int
>> instanceof type"? Having chaining apply to things that are not
>> semantically comparisons is just baffling.
> Somewhat ugly, I grant you, but if baffling?
>
>
>
More information about the Python-list
mailing list