inheritance

Yagnesh Raghava Yakkala yagnesh at live.com
Thu Apr 5 14:09:19 EDT 2012


Hello Chris,

Chris Angelico <rosuav at gmail.com> writes:
>
> If you're subclassing something, you should generally work with the
> intention that an instance of your class will function viably in any
> situation in which an instance of the parent is wanted. So if you're
> writing a method of the same name as one in the parent, you should be
> performing the exact same task and with the same parameters (possibly
> having more parameters accepted, but default values set for them).
> That's part of what it means to subclass.

Thanks for explaining. It makes sense. I see that python interpreter can
instantly tell the list of defined methods in the super class(es). So "keeping
track" thing is not at all a problem.

Thanks a lot again.

-- 
YYR




More information about the Python-list mailing list