"Fijoy George" <[EMAIL PROTECTED]> wrote: > My understanding was that every literal is a constructure of an > object. Thus, the '2.' in 'x = 2.' and the '2.' in 'x is 2.' are > different objects. Therefore, the comparison yields false.
What gave you that idea? The compiler may or may not fold together identical immutable objects when it compiles your code. In your first example the comparison is False because the two lines are compiled separately. If compiled together it might have returned True: >>> x = 2.; x is 2. True However this is purely an implementation detail. The language doesn't actually require either behaviour. -- http://mail.python.org/mailman/listinfo/python-list