Extending built-in objects/classes

Jon Clements joncle at googlemail.com
Mon Jul 3 05:55:42 EDT 2006


cmdrrickhunter at yaho.com wrote:
> 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 =)
>

That's kind of funky - I like it. However, I'd still like to know what
<what> technically is - any ideas on how to find out?

> 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.

Thanks for your post: it's most appreciated.

Cheers,

Jon.




More information about the Python-list mailing list