New submission from Jesús Cea Avión:

If L is a big sequence and I do "itertool.islice(L, 1000000, None)", islice 
will go over a million elements before returning the first that I actually 
cared.

Since L is a sequence, islice could go directly to the element 1000000.

My program performance improved hugely replacing a "for i in L[p:]" for "for i 
in (L[p] for p in range(p, len(L)))".

Using itertools and doing "for i in itertools.islice(L, p, None)" is massively 
inefficient.

----------
components: Extension Modules
messages: 220417
nosy: jcea
priority: normal
severity: normal
status: open
title: itertools.islice() goes over all the pre-initial elements even if the 
iterable can seek
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21744>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to