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

Kiuhnm kiuhnm03.4t.yahoo.it
Mon Apr 23 13:42:37 EDT 2012


On 4/23/2012 19:01, Paul Rubin 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.

Counterexample:

     import datetime
     print(datetime.datetime.now())


>> You're blaming 'is' for revealing what's really going on. 'is' is
>> /not/ implementation-dependent. It's /what's going on/ that's
>> implementation-dependent.
>> "a is b" is true iff 'a' and 'b' are the same object. Why should 'is'
>> lie to the user?
>
> Whether a and b are the same object is implementation-dependent.

My point exactly.

Kiuhnm



More information about the Python-list mailing list