Feasible in Python ? list of object , with two exeptional objects

Osiris nono at hotmail.com
Thu Dec 28 06:33:41 EST 2006


On Thu, 28 Dec 2006 11:14:27 +0100, Marc 'BlackJack' Rintsch
<bj_666 at gmx.net> wrote:

>In <8vv6p29lqjl24bkcge3iv66vflvt683akc at 4ax.com>, Osiris wrote:
>
>> Would I put all the stuff that is the same in both classes in the base
>> class and only the differing stuff in the subclasses ?
>
>Yes that's the intent of base/sub class relationships.  Baseclasses
>contain the behavior common to all their subclasses and subclasses
>implement just the different or additional behavior.
>
>> Could I move the normal length method to the superclass, and override
>> it in the special class,  like this:
>
>Yes that can be done and makes perfectly sense if the `length()` in the
>baseclass is the "normal" behavior and that baseclass can be instantiated
>and used directly.
>
>Ciao,
>	Marc 'BlackJack' Rintsch


 now we're rolling ! :-)
thnx both.



More information about the Python-list mailing list