How to find an item/items in a list?

Alex Martelli aleax at aleax.it
Tue May 6 13:29:55 EDT 2003


On Tuesday 06 May 2003 06:29 pm, Bjorn Pettersen wrote:
   ...
> > >      # throws IndexError when out-of-range
> >
> > *blink* -- can you please give an example...???
> >
> > >      return lst[index+1:]
>
> Sure,
>
>  1. 1:00 am
>  2. intially forgot the ':'
>  3. dutifully commented the behavior
>
> (I really should try to go to bed sometimes...)

I sympathize!  Yes, SLEEP is more necessary than we all
sometimes are willing to admit:-(.


> Sorry,

No problem, just for a moment wondered if there was some
case or Python version which I might be overlooking.  Now,
we're all reminded that slicing IS wonderfully soft and "patient"
wrt out-of-range indices...


Alex






More information about the Python-list mailing list