design question

Denis S. Otkidach ods at
Thu Sep 26 12:37:01 EDT 2002

On Thu, 26 Sep 2002, GonГalo Rodrigues wrote:

GR> class Wrapper1(object)
GR>     def __init__(self, <more args>):
GR>         self.__wrap = Class1()
GR>         <more initialization code>
GR> But then if I did the same with Wrapper2, it would be at
GR> least quirky
GR> since it inherits from Wrapper1 but it wraps Class1
GR> <scratches head in
GR> puzzled bewilderment>

class Wrapper1(object):
    _wrapped_class = Class1
    def __init__(self, ...):
        self._wrap = self._wrapped_class()

class Wrapper2(Wrapper1):
    _wrapped_class = Class2

Denis S. Otkidach      [ru] [ru]

More information about the Python-list mailing list