On Saturday, February 15, 2014 7:38:39 AM UTC+5:30, Chris Angelico wrote: > On Sat, Feb 15, 2014 at 12:55 PM, Rustom Mody wrote: > > On Saturday, February 15, 2014 6:27:33 AM UTC+5:30, Chris Angelico wrote: > >> Can you give an example of an ambiguous case? Fundamentally, the 'is' > >> operator tells you whether its two operands are exactly the same > >> object, nothing more and nothing less > > Fundamentally your definition above is circular: In effect > > the python expr "a is b" is the same as a is b.
> It's not circular, it's stating the definition of the operator. And > since the definition is so simple, it's impossible - at that level - > for it to be ambiguous. It's possible for equality to be ambiguous, if > you have two types which define __eq__: At what level can you explain the following? >>> x = 1234567 * 1234567 >>> x 1524155677489L >>> y = 1234567 * 1234567 >>> y 1524155677489L >>> x is y False >>> 1524155677489 == x True >>> 1524155677489 is x False >>> As against >>> x = 2*3 >>> y= 2*3 >>> x == y True >>> x is y True >>> 6 is x True >>> "Interning" you will say. Is interning a simple matter for example at the level of questioning of the OP? -- https://mail.python.org/mailman/listinfo/python-list