title: super() method resolution in python
body: <p>I am creating two custom widgets for django to use the chosen jQuery plugin, one for <code>ForeignKey</code> model fields and the other <code>ManyToManyField</code>. So, respectively, I override <code>forms.Select</code> and <code>forms.SelectMultiple</code>. I put the common functionality in a common parent class as:</p>
  
  <pre><code>class ChosenWidgetParent(object):
      class Media:
          css = {
              'all': (
                  'sub/staticfull/css/plugins/chosen/chosen.css',
              )
          }
          js = (
              'sub/staticfull/js/jquery-2.1.1.js',
              'sub/staticfull/js/plugins/chosen/chosen.jquery.js',
          )
      def render(self, name, value, attrs=None, **kwargs):
          attrs['chosen'] = 'chosen'
          rendered = super().render(name, value, attrs, **kwargs)
          return rendered + mark_safe(u'''
              &lt;script&gt;
                  $(document).ready(function () {
                     $('#id_%(name)s').chosen({
                          disable_search_threshold: 10,
                     })
                  })
              &lt;/script&gt;''' % {'name': name})
  </code></pre>
  
  <p>Note there is a call to super, which should refer to <code>Select</code>'s and <code>SelectMultiple</code>'s render methods respectively. </p>
  
  <p>And then, I define my classes:</p>
  
  <pre><code>class ChosenWidgetMultiple(widgets.SelectMultiple, ChosenWidgetParent):
      pass
  
  class ChosenWidget(widgets.Select, ChosenWidgetParent):
      pass
  </code></pre>
  
  <p>This does not work unfortunately, but when I swap the parent classes, it works. </p>
  
  <pre><code>class ChosenWidgetMultiple(ChosenWidgetParent, widgets.SelectMultiple):
      pass
  
  class ChosenWidget(ChosenWidgetParent, widgets.Select):
      pass
  </code></pre>
  
  <p>Can someone explain me why?</p>