title: How does get_FIELD_display (in django) work?
body: <p>I'm a novice in Django and Python, and recently came across a number of methods in Django docs, such as Model.get_FOO_display(). Help page says that you can substitute FOO for a name of a field. I've been trying to figure out how that is possible in Python and looked into 'Model' class souce. 
  There I came across this:</p>
  
  <pre><code>    def _get_FIELD_display(self, field):
          value = getattr(self, field.attname)
          return force_unicode(dict(field.flatchoices).get(value, value), strings_only=True)
  </code></pre>
  
  <p>I can't understand how it's possible in Python to:
  1) to write this</p>
  
  <pre><code>class Person(models.Model):
      gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
  p = Person(name='John', gender='M')
  
  p.get_gender_display()
  </code></pre>
  
  <p>So, how does Python 'change' FIELD (or FOO) into gender? Is it some sort of Python 'wicked' notation? (Sorry, I can't ask more clearly) Coud you point to some Python man page?</p>
  
  <p>2) why the source from Model class declares _get_FIELD_display() with the leading underscore, but the Python doc extract from above writes "p.get_gender_display()" without the underscore? Again, could you please give a Python man page for this?</p>