Making a list-inhereted object return standard repr?
Jason Orendorff
jason at jorendorff.com
Fri Feb 1 23:32:57 EST 2002
Philip Swartzleonard wrote:
> Ok, so i decided to make my container class inherit from list, [...]
> I want to change __repr__ and __str__ to do something more like
> the first case again [...]
class Foo(list):
def __repr__(self):
basic = object.__repr__(self)
values = list.__repr__(self)
return basic[:-1] + ' containing ' + values + '>'
## Jason Orendorff http://www.jorendorff.com/
More information about the Python-list
mailing list