Rich __repr__

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Nov 1 15:29:23 EST 2005


In <dk4hai$euj$1 at rose.polar.local>, Ben Finney wrote:

>     class Human_Sex(str):
>         def __repr__(self):
>             repr_str = "%s(name=%s)" % (
>                 self.__class__.__name__,
>                 str.__repr__(self)
>             )
>             return repr_str

I'm a bit surprised that `Human_Sex` is subclassing `str`.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list