Following is my code snippet. when i run the program it gives me the following error.
@functools.total_ordering
AttributeError: 'module' object has no attribute 'total_ordering'
I'm using python 3.1
import functools
@functools.total_ordering
class Abs(object):
def __init__(self,num):
self.num=abs(num)
def __eq__(self,other):
return self.num==abs(other.num)
def __lt__(self,other):
return self.num < abs(other.num)
five=Abs(-5)
four=Abs(-4)
print(five > four)
Is something missing from the import statement ?