Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Mark Dickinson
On Nov 19, 4:23 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Yep; looks like a bug in the set/frozenset implementation. Thanks! I was about to report this to bugs.python.org, but it looks as though Raymond's been at the time machine again: http://bugs.python.org/issue1721812 It's fixed

Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Terry Reedy
srinivasan srinivas wrote: 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

Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Gabriel Genellina
En Wed, 19 Nov 2008 11:56:28 -0200, Mark Dickinson <[EMAIL PROTECTED]> escribió: On Nov 19, 12:39 pm, srinivasan srinivas <[EMAIL PROTECTED]> wrote: 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'

Re: Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread Mark Dickinson
On Nov 19, 12:39 pm, srinivasan srinivas <[EMAIL PROTECTED]> wrote: > 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' I guess you need to implement the dif

Inheriting frozenset gives bug if i overwrite __repr__ method

2008-11-19 Thread 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 __re