Message70714
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). |
|
Date |
User |
Action |
Args |
2008-08-04 19:13:34 | exarkun | set | recipients:
+ exarkun |
2008-08-04 19:13:34 | exarkun | set | messageid: <1217877214.51.0.0221142821046.issue3500@psf.upfronthosting.co.za> |
2008-08-04 19:13:33 | exarkun | link | issue3500 messages |
2008-08-04 19:13:32 | exarkun | create | |
|