how can I subclass a string (str)?

Martin v. Löwis loewis at informatik.hu-berlin.de
Tue Aug 13 14:26:35 EDT 2002


"Matt Gerrans" <matt_gerrans at hp.com> writes:

> class mystr(str):
>    def HexRepr(self):
>       print 'A hex on ye!'

Sure - but what if you want to refer to the internal representation as
well?

Regards,
Martin




More information about the Python-list mailing list