See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
something like this

-#!/usr/bin/env python
-class Borg(object):
-    _shared_state = {}
-    def __init__(self):
-        self.__dict__ = self._shared_state
-
-class Duck(Borg):
-    def __init__(self):
-        super(Duck, self).__init__()
-        self.__covering = "feathers" # all ducks are feathered
-    def covering(self):
-        return self.__covering
-
-class Rabbit(Borg):
-    def __init__(self):
-        super(Rabbit, self).__init__()
-        self.__covering = "fur" # all rabbits are furry
-    def covering(self):
-        return self.__covering
-
-bugs = Rabbit()
-daffy = Duck()
-print daffy.covering()
-print bugs.covering()

[EMAIL PROTECTED]:~$ ./test2.py
feathers
fur
[EMAIL PROTECTED]:~$

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to