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?
>
>
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 i
On Thu, Dec 13, 2012 at 1:39 PM, Daniel Fetchinson
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
sequences. The islice v
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 n
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
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 n
>>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 onl
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 numb
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"
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
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
10 matches
Mail list logo