[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Tim Peters
Tim Peters added the comment: Please take requests for discussion to comp.lang.python. Many people there understand this behavior and will be happy to explain it in as much detail as you want. The bug tracker is not the place for this. ___ Python tracker <

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Gregory P. Smith
Gregory P. Smith added the comment: the only intelligence i'm challenging is that this is not appropriate for a bug tracker. bring it up on a users mailing list. ___ Python tracker ___ _

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Hatem
Hatem added the comment: Atleast you didnt really challenge my inelegence like greg did. If you look at my small interpreted session, is returned true the first time. Why is that. The ticket title may not have been perfect, I was trying to be sarcastic/funny. I am asking why are objects sometim

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Tim Peters
Tim Peters added the comment: "is" is for testing object identity, not numeric equality. That "1 is 1" is always true is simply an implementation detail common to all recent versions of CPython, due to CPython caching "very small" integer objects. The language definition neither requires nor f

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Hatem
Hatem added the comment: Really, "is" is not equality but is object equivalence, wow I did not know that. So why is the first one true MR. This is truly a bug, why is the first one optimized while the second one isn't. And how come integers are allways optimized in that sense. Go close other tic

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Gregory P. Smith
Gregory P. Smith added the comment: this is not a bug. ask this type of question on comp.lang.python. in short: 'is' is not an equality comparison operator. it compares object instance identity. -- nosy: +gregory.p.smith resolution: -> invalid status: open -> closed ___

[issue4638] 1 is 1 is allways true while 1.0 is 1.0 may sometimes be true

2008-12-11 Thread Hatem
New submission from Hatem : In [29]: a,b = 1.0,1.0 In [30]: a is b Out[30]: True In [31]: a = 1.0 In [32]: b = 1.0 In [33]: a is b Out[33]: False # ?!? -- components: Interpreter Core messages: 77654 nosy: nassrat severity: normal status: open title: 1 is 1 is allways true while 1.0 is