diff options
author | Brian Harring <ferringb@gentoo.org> | 2005-08-16 00:33:27 +0000 |
---|---|---|
committer | Brian Harring <ferringb@gentoo.org> | 2005-08-16 00:33:27 +0000 |
commit | 3bbd66e82bfeb119472858e3c8a136265a2af896 (patch) | |
tree | ab2c2dadf040da9d2399791d99392570df3c133d | |
parent | no package class defined yet, but fixed imports so that querying is usable now. (diff) | |
download | portage-cvs-3bbd66e82bfeb119472858e3c8a136265a2af896.tar.gz portage-cvs-3bbd66e82bfeb119472858e3c8a136265a2af896.tar.bz2 portage-cvs-3bbd66e82bfeb119472858e3c8a136265a2af896.zip |
cause standard enumerate sucks and you can't do offset slices
-rw-r--r-- | portage/util/iterate.py | 12 |
1 files changed, 12 insertions, 0 deletions
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 |