Hi,
I'm jumping in the discussion as I've tried - hard - to do something similar in
the past.
However, I'll second what has been said: mixins should be on the left side.
Is there a reason your code can't be similar to:
#class View(object):
#def __init__(self):
#print "View init"
Sorry, I had problems to get to my google account, but finally I'm here :).
I wrote to the ticket meanwhile, but you probably not in CC, so I paste it
here, too:
Having this example:
class View(object):
def __init__(self):
print "View init"
#super(View, self).__init__()
I read the original request as a matter of principle and not something born
from an actual need.
View is intended to be the rightmost class in an inheritance scheme. I haven't
seen a sane use case for injecting it as a mixin.
This change is more likely to allow beginners to shoot themselves
I'm not sure that's really sensible style, tho - classes that are intended
to be used as mixins should call super, and the base class should be the
last in the hierarchy.
class FooMixin(object):
def __init__(self):
super(FooMixin, self).__init__()
self.foo =
It matters if you're going to mixin a class whose common ancestor is
object, e.g.:
class FooMixin(object):
def __init__(self):
self.foo = 3
class MyModel(models.Model, FooMixin):
pass
if models.Model.__init__ doesn't call super().__init__, then
FooMixin.__init__ won't be
Calling super in base classes (ie anything that inherits from 'object')
just seems unnecessary and obscure to me. It's not a pattern I use or have
seen, and after playing around a bit I can't see any sensible case where
it'd make a difference. `View` should always be the last (right-most)