If you're using python3, you can simply do: a, b, c, *rest = myiterable
Demian Brecht http://demianbrecht.github.com On 2012-12-13 11:37 AM, "Daniel Fetchinson" <fetchin...@googlemail.com> wrote: >Hi folks, I swear I used to know this but can't find it anywhere: > >What's the standard idiom for unpacking the first few items of an >iterable whose total length is unknown? > >Something like > >a, b, c, _ = myiterable > >where _ could eat up a variable number of items, in case I'm only >interested in the first 3 items? > >Cheers, >Daniel > > >-- >Psss, psss, put it down! - http://www.cafepress.com/putitdown >-- >http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list