title: Python check first and last index of a list
body: <p>Assuming I have object_list list which contains objects.</p>
  
  <p>I want to check if my current iteration is is at the first or the last.</p>
  
  <pre><code>for object in object_list:
      do_something
      if first_indexed_element:
          do_something_else
      if last_indexed_element:
          do_another_thing
  </code></pre>
  
  <p>How can this be achieved? I know that I can use range and count index but if feels clumsy.</p>
  
  <p>Regards</p>