Re: A policy on calling super()

2013-10-03 Thread Xavier Ordoquy
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"

Re: A policy on calling super()

2013-10-02 Thread Glin
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__()

Re: A policy on calling super()

2013-09-30 Thread Aymeric Augustin
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

Re: A policy on calling super()

2013-09-29 Thread Tom Christie
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 =

Re: A policy on calling super()

2013-09-29 Thread Alex Gaynor
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

Re: A policy on calling super()

2013-09-29 Thread Tom Christie
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)