diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-23 06:02:17 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-06-23 06:02:17 +0000 |
| commit | fc20eeec47f1bf7b178a0432fa74f54a452b62ce (patch) | |
| tree | f3b94d120d7dafd1a11e617441324e103b0a7773 /django/utils | |
| parent | 5f5f1d913bbe25dd9a33a2759144160e1473c12a (diff) | |
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
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/itercompat.py | 6 |
1 files changed, 6 insertions, 0 deletions
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: |
