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
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
On 2012-12-13 19:37, Daniel Fetchinson 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
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
On 12/13/2012 03:09 PM, Daniel Fetchinson 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
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
On 12/13/2012 03:39 PM, Daniel Fetchinson 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
On Thu, Dec 13, 2012 at 1:39 PM, Daniel Fetchinson
fetchin...@googlemail.com wrote:
If you know the sequence has at least n items, you
can do a, b, c = seq[:3]
Yeah, that's probably the simplest, without all the fancy stuff :)
That only works for sequences, though. Not all iterables are
On 12/13/2012 3:09 PM, MRAB wrote:
On 2012-12-13 19:37, Daniel Fetchinson 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?
An hinted by some of the answers, this
Terry Reedy wrote:
On 12/13/2012 3:09 PM, MRAB wrote:
On 2012-12-13 19:37, Daniel Fetchinson 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?
An hinted by
10 matches
Mail list logo