c[:]()

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Jun 6 03:30:06 EDT 2007


In <pan.2007.06.06.02.42.47 at REMOVE.THIS.cybersource.com.au>, Steven
D'Aprano wrote:

> Is there a general Pythonic idiom for efficiently walking over part of a 
> sequence without copying it first? Should there be?

What about using `itertools.islice()`:

for e in islice(a, 4):
    pass

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list