[Tutor] Poorly understood error involving class inheritance

Serdar Tumgoren zstumgoren at gmail.com
Thu Sep 10 22:51:18 CEST 2009


> When you sub "int" for "str", it seems to work. Is there a reason
> you're not just subclassing "object"? I believe doing so would give
> you the best of both worlds.
>

Of course, I should qualify the above -- the "str" subclass inherits
very different methods than "int" or "object".

http://docs.python.org/library/stdtypes.html#sequence-types-str-unicode-list-tuple-buffer-xrange

If retaining the string methods is important for your use case, you
might require a more nuanced solution...


More information about the Tutor mailing list