Extending built-in objects/classes

cmdrrickhunter@yaho.com conrad.ammon at gmail.com
Mon Jul 3 05:39:46 EDT 2006


My experiance is mostly with old-style classes, but here goes.

first off, the <what> question is actually easier than you think.
After all, self is an instance of a string, so   self[3:4] would grab
the slice of characters between 3 and 4 =)

as for __init__, what I have found is that if you do not include an
__init__ function, the parent class's __init__ gets inherited, just
like any other function, so you dont need one.  If you have multiple
inheritance, however, you must include an __init__ which calls the
__init__ on every parent, otherwise only the first parent's gets
called.




More information about the Python-list mailing list