title: Is it better to save the length of a list that I use several time?
body: <p>I know about inlining, and from what I checked it is not done by the Python's compiler.</p>
  
  <p>My question is : is there any optimizations with the python's compiler which transforms :</p>
  
  <pre><code>print myList.__len__()
  for i in range(0, myList.__len__()):
      print i + myList.__len__()
  </code></pre>
  
  <p>to</p>
  
  <pre><code>l = myList.__len__()
  print l
  for i in range(0, l):
      print i + l
  </code></pre>
  
  <p>So is it done by the compiler ?<br>
  If it is not : is it worth it to do it by myself ?</p>
  
  <p>Bonus question (not so related) : I like to have a lot of functions (better for readability IMHO)... like there is no inlining in Python is this something to avoid (lots of functions) ?</p>