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

Devin Jeanpierre jeanpierreda at gmail.com
Mon Apr 23 00:42:06 EDT 2012


On Mon, Apr 23, 2012 at 12:34 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Sun, 22 Apr 2012 12:43:36 -0700, John Nagle wrote:
>
>> On 4/20/2012 9:34 PM, john.tantalo at gmail.com wrote:
>>> On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
>>>
>>>> I believe it says somewhere in the Python docs that it's undefined and
>>>> implementation-dependent whether two identical expressions have the
>>>> same identity when the result of each is immutable
>>
>>     Bad design.  Where "is" is ill-defined, it should raise ValueError.
>
> "is" is never ill-defined. "is" always, without exception, returns True
> if the two operands are the same object, and False if they are not. This
> is literally the simplest operator in Python.
>
> John, you've been using Python for long enough that you should know this.
> I can only guess that you are trolling, although I can't imagine why.

Could you refrain from personal attacks? Especially considering that
he said nothing unreasonable. It's you that doesn't appear to know
this (relatively common? I thought it was universal...) definition of
"ill-defined":

http://mathworld.wolfram.com/Ill-Defined.html

"() is ()" does not have one unique value in all interpretations. It
can be either True or False, depending on the Python. (At least, I
think this was the consensus). Therefore "is" is ill-defined in this case.

-- Devin



More information about the Python-list mailing list