title: django: Purpose of django.utils.functional.SimpleLazyObject?
body: <p>I ran into an issue where I assigned <code>request.user</code> to a variable called <code>prior_user</code>, then essentially authenticated the user, then checked to see if <code>request.user != prior_user</code>. I expected them not to be the same and that <code>prior_user</code> should contain `AnonymousUser. To my surprise, they were the same. </p>
  
  <p>Sample code:</p>
  
  <pre><code>prior_user = request.user   # request object, obtained froma  view
  authenticate_user(request)   # some function that authenticates
  print prior_user.username != request.user.username   # returns False i.e.they are the same!
  </code></pre>
  
  <p>I then discovered prior_user actually contains an instance of django.utils.functional.SimpleLazyObject so I assume it is some sort of lazy lookup type thing i.e. prior_user's value isn't looked up until actually used. Looking at the source code, I cannot confirm this.</p>
  
  <p>Anyone with django experience can tell me what is going on and why it is needed? </p>
  
  <p>This leaves me a little shaken, because the usual assignment statement doesn't work the way I expect and what else within Django acts like this? Nor did I see this described in the <a href="https://docs.djangoproject.com/en/dev/ref/request-response/#httprequest-objects">docs</a>.</p>
  
  <p>So anyone with super human knowledge of django can provide some clarity?</p>