title: How does passing a lambda function for a property() work when extending Django's user model?
body: <p>I have been looking at extending the Django user model, and while I am confident I can make it work, there is a line of code that I really want to understand.</p>
  
  <p>I have been referencing the following tutorial:
  <a href="http://blog.tivix.com/2012/01/06/extending-user-model-in-django/" rel="nofollow">http://blog.tivix.com/2012/01/06/extending-user-model-in-django/</a></p>
  
  <p>but I can not for the life of me understand how the following line of code works:</p>
  
  <pre><code>User.profile = property(lambda u: u.get_profile() )
  </code></pre>
  
  <p>If I understand correctly, this sets the getter method for User.profile to an anonymous function that takes a user as an argument and returns the profile, BUT, if I am referencing myuser.profile, when is the argument actually passed?</p>
  
  <p>I hope I communicated myself properly. Any help understanding this would be greatly appreciated!</p>