title: Using the same method name for two different method headers
body: <p>I'm experiencing a little issue, while working with Python/Django. I have a class, called 'Plantao', and a method 'get_ultima_posicao', which, I wanted to behave in the following way:</p>
  <p>If called by the class, like Plantao.get_ultima_posicao, it should expect two parameters, one mandatory and one optional. And when called by a class object, like p.get_ultima_posicao (p being an instance of Plantao) the only parameter it should expect would be self.</p>
  <p>Is there a way of doing that?</p>
  <p>I know there's a way of doing something like polymorphism, using (self, *args) in the method header, but since one of my methods should be static, using @staticmethod, it doesn't have self as a parameter.</p>
  <p><strong>EDIT</strong></p>
  <pre><code>In [4]: Plantao.get_ultima_posicao(empresa = 1)
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  
  /*************************************/&lt;ipython console&gt; in &lt;module&gt;()
  
  TypeError: unbound method get_ultima_posicao() must be called with Plantao instance as first argument (got nothing instead)
  
  In [5]: planta.get_ultima_posicao()
  Out[5]: 0
  </code></pre>
  <p>Where  planta.empresa = 1. I wanted that to work, and both executions returning the same values</p>
  <p>I wanted the methods definitions to be something like:</p>
  <pre><code>def get_ultima_posicao(self):
  
  AND
  
  @staticmethod
  def get_ultima_posicao(empresa, data = datetime.date.today()):
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p>Ok, here's my model for the Plantao class:</p>
  <pre><code>usuario     = models.ForeignKey(Usuario, null=True, blank=True) # user
  empresa     = models.ForeignKey(Empresa, null=True, blank=True) # department
  posicao     = models.IntegerField(default=0)                    # position in queue
  data        = models.DateField(null=True, blank=True)           # date added in queue
  </code></pre>
  <p>So, I may know which deparment I want to get an user from, so why would I need to retrieve one Plantao object just to search for it? At the same time, if I already retrieved it, why would I need to get the deparment again, if it's already in Plantao object? That's why I want to do that.</p>
  <p><strong>EDIT</strong></p>
  <p>In hope it may help finding a solution I'm adding the functions codes here:</p>
  <pre><code>@staticmethod
  def get_ultima_posicao(empresa, data = datetime.date.today()):
      if empresa is None:
          return 'Empresa invalida'
  
      ultima = Plantao.get_ultimo_fila(empresa = empresa)
      plantao = Plantao.objects.filter(data=data, empresa=empresa).order_by('posicao')
  
      usuario = None
  
      for i in plantao:
          ultima += 1
          i.posicao = ultima
          i.save()
          if i.usuario.atendimento_pendente() == False and i.usuario.cliente_aguardando() == False and i.usuario.esta_online() == True:
              return i.usuario
  
      return &quot;Nenhum usuario disponivel na escala&quot;
  
  
  def get_ultima_posicao(self):
      if self.empresa is None:
          return 'Empresa invalida'
  
      ultima = Plantao.get_ultimo_fila(empresa = self.empresa)
      plantao = Plantao.objects.filter(data=self.data, empresa=self.empresa).order_by('posicao')
  
      usuario = None
  
      for i in plantao:
          ultima += 1
          i.posicao = ultima
          i.save()
          if i.usuario.atendimento_pendente() == False and i.usuario.cliente_aguardando() == False and i.usuario.esta_online() == True:
              return i.usuario
  
      return &quot;Nenhum usuario disponivel na escala&quot;
  </code></pre>