Multiple Mixins and properties
<p>I am trying to create a mixin class that has it's own properties, but as the class has no <strong>init</strong> to initialize the "hidden" variable behind the property.</p>

<pre><code>class Software:

    __metaclass__ = ABCMeta

    @property
    def volumes(self):
        return self._volumes

    @volumes.setter
    def volumes(self, value):
        pass

class Base(object):

    def __init__(self):
        self._volumes = None

class SoftwareUser(Base, Software):

    def __init__(self):
        super(Base, self).__init__()
</code></pre>

<p>So above is the best that I have come up with to solve this but the reality is that the _volumes dosn't really belong in the base. I could add an init to the Software class but then the super call wont work on both mixins.</p>

<p>The second is that I will need multiple mixins dependent on the incoming call they will always need the base, but the mixins will change so I dont really want variables from mixins that aren't mixed in for that call. </p>

<p>Is there a way that i can have the mixin add it's variables to the class if it is mixed in perhaps dynamically call the init of the mixin class ?.</p>

<p>Any questions let me know.</p>

<p>Thanks</p>

<p>Ok so here is what I came up with, I am open to other answers, if I have made this way over complicated.</p>

<pre><code>class Software:

    @property
    def volumes(self):
       return self._volumes

    @volumes.setter
    def volumes(self, value):
       pass

    def __init__(self):
        self._volumes = None


class Base(object):

    def __init__(self):
        other_vars = None


class SoftwareUser(Base, Software):

    def _bases_init(self, *args, **kwargs):
        for base in type(self).__bases__:
            base.__init__(self, *args, **kwargs)

    def __init__(self, *args, **kwargs):
        self._bases_init(*args, **kwargs)
</code></pre>

python mixins