From fc20eeec47f1bf7b178a0432fa74f54a452b62ce Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 23 Jun 2007 06:02:17 +0000 Subject: Fixed a Python 2.3 incompatibility I overlooked in [5516]. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5517 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/itercompat.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'django/utils') diff --git a/django/utils/itercompat.py b/django/utils/itercompat.py index 48a2d99d3a..ff814bfd7b 100644 --- a/django/utils/itercompat.py +++ b/django/utils/itercompat.py @@ -45,6 +45,12 @@ def groupby(iterable, keyfunc=None): l.append(item) yield lastkey, l +# Not really in itertools, since it's a builtin in Python 2.4 and later, but it +# does operate as an iterator. +def reversed(data): + for index in xrange(len(data)-1, -1, -1): + yield data[index] + if hasattr(itertools, 'tee'): tee = itertools.tee else: -- cgit v1.3