On Thu, 02 Feb 2012 07:23:04 +, Paulo da Silva wrote:
> Em 01-02-2012 04:55, Cameron Simpson escreveu:
>> On 01Feb2012 03:34, Paulo da Silva
>> wrote:
>
>> | BTW, iter seems faster than iterating thru mylist[1:]!
>>
>> I would hope the difference can be attributed to the cost of copying
>>
Em 01-02-2012 04:55, Cameron Simpson escreveu:
> On 01Feb2012 03:34, Paulo da Silva wrote:
> | BTW, iter seems faster than iterating thru mylist[1:]!
>
> I would hope the difference can be attributed to the cost of copying
> mylist[1:].
I don't think so. I tried several times and the difference
Paul Rubin, 01.02.2012 10:25:
> Paulo da Silva writes:
>> process1(mylist[0])
>> for el in mylist[1:]:
>> process2(el)
>>
>> This way mylist is almost duplicated, isn't it?
>
> I think it's cleanest to use itertools.islice to get the big sublist
> (not tested):
>
>from itertools import i
On 1 February 2012 08:11, Peter Otten <__pete...@web.de> wrote:
> Arnaud Delobelle wrote:
> The example should be
>
>> from itertools import islice:
>
> for el in islice(mylist, 1, None):
>> process2(el)
Oops!
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
Paulo da Silva writes:
> process1(mylist[0])
> for el in mylist[1:]:
> process2(el)
>
> This way mylist is almost duplicated, isn't it?
I think it's cleanest to use itertools.islice to get the big sublist
(not tested):
from itertools import islice
process1 (mylist[0])
for el in i
Arnaud Delobelle wrote:
>> Em 01-02-2012 01:39, Paulo da Silva escreveu:
>>> What is the best way to iterate thru a huge list having the 1st element
>>> a different process? I.e.:
> Nobody mentioned itertools.islice, which can be handy, especially if
> you weren't interested in the first element
On 1 February 2012 03:16, Paulo da Silva wrote:
> Em 01-02-2012 01:39, Paulo da Silva escreveu:
>> Hi!
>>
>> What is the best way to iterate thru a huge list having the 1st element
>> a different process? I.e.:
>>
>> process1(mylist[0])
>> for el in mylist[1:]:
>> process2(el)
>>
>> This way
On 01Feb2012 03:34, Paulo da Silva wrote:
| Em 01-02-2012 03:16, Paulo da Silva escreveu:
| > I think iter is nice for what I need.
| > Thank you very much to all who responded.
|
| BTW, iter seems faster than iterating thru mylist[1:]!
I would hope the difference can be attributed to the cost o
Em 01-02-2012 03:16, Paulo da Silva escreveu:
> Em 01-02-2012 01:39, Paulo da Silva escreveu:
>> Hi!
>>
>> What is the best way to iterate thru a huge list having the 1st element
>> a different process? I.e.:
>>
>> process1(mylist[0])
>> for el in mylist[1:]:
>> process2(el)
>>
>> This way myl
Em 01-02-2012 01:39, Paulo da Silva escreveu:
> Hi!
>
> What is the best way to iterate thru a huge list having the 1st element
> a different process? I.e.:
>
> process1(mylist[0])
> for el in mylist[1:]:
> process2(el)
>
> This way mylist is almost duplicated, isn't it?
>
> Thanks.
I t
On 01/02/12 01:39, Paulo da Silva wrote:
Hi!
What is the best way to iterate thru a huge list having the 1st element
a different process? I.e.:
process1(mylist[0])
for el in mylist[1:]:
process2(el)
This way mylist is almost duplicated, isn't it?
Thanks.
Maybe (untested),
it = iter
On 1 February 2012 12:39, Paulo da Silva wrote:
> Hi!
>
> What is the best way to iterate thru a huge list having the 1st element
> a different process? I.e.:
>
> process1(mylist[0])
> for el in mylist[1:]:
>process2(el)
>
> This way mylist is almost duplicated, isn't it?
>
If you are sur
On 01Feb2012 01:39, Paulo da Silva wrote:
| What is the best way to iterate thru a huge list having the 1st element
| a different process? I.e.:
|
| process1(mylist[0])
| for el in mylist[1:]:
| process2(el)
|
| This way mylist is almost duplicated, isn't it?
Yep.
What about (untested):
13 matches
Mail list logo