snake
changeset 120:a8549a69f959
fixed line enumerator snake.File
author | Daniil Alexeyevsky <me.dendik@gmail.com> |
---|---|
date | Mon, 20 Dec 2010 14:55:40 +0300 |
parents | 0255870e79ce |
children | 06e4b4ea7596 |
files | snake.py |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/snake.py Mon Dec 20 14:45:04 2010 +0300 1.2 +++ b/snake.py Mon Dec 20 14:55:40 2010 +0300 1.3 @@ -15,7 +15,10 @@ 1.4 self.file = file 1.5 self.name = file.name 1.6 self.line_no = 0 1.7 + self.iterator = self.enumerate_lines() 1.8 def __iter__(self): 1.9 + return self.iterator 1.10 + def enumerate_lines(self): 1.11 for line_no, line in enumerate(self.file, self.line_no): 1.12 self.line_no = line_no 1.13 yield line