S
srinivasan srinivas
Hi,
I am getting an error while executing the following snippet. If i comment out method __repr__ , it works fine.
class fs(frozenset):
def __new__(cls, *data):
data = sorted(data)
self = frozenset.__new__(cls, data)
self.__data = data
return self
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.__data)
a1 = fs(1,2,3)
a2 = fs(3,4,5)
print a1.difference(a2)
Error:
return "%s(%r)" % (self.__class__.__name__, self.__data)
AttributeError: 'fs' object has no attribute '_fs__data'
Please help me in fixing this.
Thanks,
Srini
Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
I am getting an error while executing the following snippet. If i comment out method __repr__ , it works fine.
class fs(frozenset):
def __new__(cls, *data):
data = sorted(data)
self = frozenset.__new__(cls, data)
self.__data = data
return self
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.__data)
a1 = fs(1,2,3)
a2 = fs(3,4,5)
print a1.difference(a2)
Error:
return "%s(%r)" % (self.__class__.__name__, self.__data)
AttributeError: 'fs' object has no attribute '_fs__data'
Please help me in fixing this.
Thanks,
Srini
Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/