Robert Kern wrote:
George Sakkis wrote:
I stumbled upon the following strangeness (python 2.6.2):
getattr(int, '__gt__')
<method-wrapper '__gt__' of type object at 0x822b7c0>
getattr(5, '__gt__')
Traceback (most recent call last):n
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute '__gt__'
Is this a bug ?
I believe that ints in the 2.x series still use __cmp__. In Python 3.x,
__gt__ and the rest are defined.
Correct:
Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 5 .__gt__ # notice space after 5
<method-wrapper '__gt__' of int object at 0x1E1FC058>
--
http://mail.python.org/mailman/listinfo/python-list