Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91248

Re: different types of inheritence...

Newsgroups comp.lang.python
Date 2015-05-26 07:57 -0700
References <544f53cb-e404-41a4-aa2e-0db27c845546@googlegroups.com>
Message-ID <c6b24dce-c0da-4753-9775-b38816b579c8@googlegroups.com> (permalink)
Subject Re: different types of inheritence...
From zipher <dreamingforward@gmail.com>

Show all headers | View raw


> 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


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

different types of inheritence... zipher <dreamingforward@gmail.com> - 2015-05-21 19:14 -0700
  Re: different types of inheritence... zipher <dreamingforward@gmail.com> - 2015-05-26 07:57 -0700
    Re: different types of inheritence... Michael Torrie <torriem@gmail.com> - 2015-05-26 14:52 -0600
      Re: different types of inheritence... zipher <dreamingforward@gmail.com> - 2015-05-27 11:12 -0700
    Re: different types of inheritence... Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-26 15:12 -0600

csiph-web