different types of inheritence...
zipher
dreamingforward at gmail.com
Tue May 26 10:57:16 EDT 2015
> Apart from object composition or mix-in style, I want to illustrate something regarding the "arrow" of inheritance.
>
> class super_dict(dict):
>
> def __init__(self, init={}, default_value=0, collision_function=None):
> *expands what dict can do*
>
> def get_default(self): #stupid method to illustrate a point
> return self._default_value
>
> class specialized_dict(dict):
>
> def update(self, other):
> *change the behavior of how updates work*
>
> def setdefault(self, key, value):
> if key=sentinel:
> self[key]=0
> else:
> self[key]=value
Okay, perhaps I wasn't being clear....
THESE OBJECTS HAVE THE SAME CLASS *SYNTAX*, BUT COMPLETELY DIFFERENT *SEMANTICS*.
Comprende? I'm not trying to be cryptic here. This is a bit of OOP theory to be discussed.
Mark
More information about the Python-list
mailing list