title: How to slice (in Python) "all but the last n" items when n may be zero?
body: <p>I have a list of items in Python and I need to get "all but the last N" items.  It needs to work when N is zero (in which case I want the whole list) and when N is greater than or equal to the length of the list (in which case I want an empty list).
  This works in most cases:</p>
  
  <pre><code>mylist=[0,1,2,3,4,5,6,7,8,9]
  print( mylist[:-n] )
  </code></pre>
  
  <p>But it fails in the case where N is zero.  <code>mylist[:0]</code> returns an empty list: <code>[]</code>.  Is there a Python slicing notation that will do what I want, or a simple function?</p>