From e41c4c6cc3c3ea581c091116df72555eb5c5d980 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 11 Aug 2012 00:02:04 +0200 Subject: [PATCH] implemented xrange --- mixin/builtins.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mixin/builtins.py b/mixin/builtins.py index 7096c101..391d7c7d 100644 --- a/mixin/builtins.py +++ b/mixin/builtins.py @@ -26,6 +26,18 @@ def range(start, stop=None, step=1): return [0] +class xrange(): + # Attention: this function doesn't exist in Py3k (there it is range). + def __iter__(self): + yield 1 + + def count(self): + return 1 + + def index(self): + return 1 + + #-------------------------------------------------------- # descriptors #--------------------------------------------------------