[issue1981] operator is

2008-02-01 Thread Guido van Rossum
Guido van Rossum added the comment: id(a.__abs__) == id(a.__abs__) has a completely different explanation -- it so happens that the first instantiation of a.__abs__ is freed after id() is called on it and the second instantiation happens to reuse that same memory block. -- nosy:

[issue1981] operator is

2008-01-31 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: It's actually documented in http://docs.python.org/dev/reference/datamodel.html Note that the transformation from function object to (unbound or bound) method object happens each time the attribute is retrieved from the class or instance --

[issue1981] operator is

2008-01-31 Thread Georg Brandl
Georg Brandl added the comment: Yes, it is expected since the descriptor access to methods creates a new bound method object every time. The is operator does not work special with methods. There is another issue about documenting this, so closing as a duplicate. -- nosy: +georg.brandl

[issue1981] operator is

2008-01-31 Thread Alexander Shigin
New submission from Alexander Shigin: Hello, The operator is works strange with methods, i.e.: a = 1 a.__abs__ is a.__abs__ False If this is the preferred behavior by some reasons, I think documentation should explain it. It was tested on python 2.4.4, 2.5.1 and trunk r60477. --

[issue1981] operator is

2008-01-31 Thread Alexander Shigin
Alexander Shigin added the comment: I think it's good idea to make a note in Comparisons section or make some reference to data model section. The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yields the inverse truth