why () is () and [] is [] work in other way?

Ian Kelly ian.g.kelly at gmail.com
Mon Apr 23 13:47:39 EDT 2012


On Mon, Apr 23, 2012 at 11:01 AM, Paul Rubin <no.email at nospam.invalid> wrote:
> Kiuhnm <kiuhnm03.4t.yahoo.it> writes:
>> I can't think of a single case where 'is' is ill-defined.
>
> If I can't predict the output of
>
>    print (20+30 is 30+20)  # check whether addition is commutative
>    print (20*30 is 30*20)  # check whether multiplication is commutative
>
> by just reading the language definition and the code, I'd have to say
> "is" is ill-defined.

It seems to me that one could equally argue that "+" is ill-defined,
because the output of "x + y" could just as easily be 1729 or 42.  In
either case the problem is not in the operator, but in determining
exactly what the left and right sides evaluate to.



More information about the Python-list mailing list