On Wed, Dec 16, 2009 at 5:39 AM, Steven D'Aprano <
st...@remove-this-cybersource.com.au> wrote:

> for item in seq[1:]:
>    process(item)
>
> without making an unnecessary copy of almost all of seq.
>

I use the following idiom:
for i in range(1, len(seq)):
    process(seq[i])

Alternately, if I'm using the blist extension type that I wrote, then
seq[1:] is O(log n).
http://pypi.python.org/pypi/blist/

--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to