From 3bbd66e82bfeb119472858e3c8a136265a2af896 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Tue, 16 Aug 2005 00:33:27 +0000 Subject: cause standard enumerate sucks and you can't do offset slices --- portage/util/iterate.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 portage/util/iterate.py diff --git a/portage/util/iterate.py b/portage/util/iterate.py new file mode 100644 index 0000000..34ce894 --- /dev/null +++ b/portage/util/iterate.py @@ -0,0 +1,12 @@ +# Copyright: 2005 Gentoo Foundation +# Author(s): Brian Harring (ferringb@gentoo.org) +# License: GPL2 +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/util/iterate.py,v 1.1 2005/08/16 00:33:27 ferringb Exp $ + +from itertools import islice + +def enumerate(iter, start, end): + count = start + for r in islice(iter, start, end): + yield count, r + count+=1 -- cgit v1.2.3-65-gdbad