New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>: If a method is inherited by two different classes, then the unbound method objects which can be retrieved from those classes compare equal to each other. For example:
Python 2.6b2+ (trunk:65502M, Aug 4 2008, 15:05:07) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> class X: ... def y(self): ... pass ... >>> class A(X): ... pass ... >>> class B(X): ... pass ... >>> A.y == B.y True This is bad behavior because A.y and B.y are otherwise distinguishable (for example, they repr differently, they have different values for the `im_class´ attribute, they cannot be used interchangably for invoking the method because they place different type restrictions on the `self´ parameter, etc). ---------- components: Interpreter Core messages: 70714 nosy: exarkun severity: normal status: open title: unbound methods of different classes compare equal type: behavior versions: Python 2.4, Python 2.5, Python 2.6 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3500> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
