From 0cccd82b2a3d624f0a31a2a218f8d4948d954425 Mon Sep 17 00:00:00 2001 From: cheater Date: Wed, 8 Feb 2012 08:14:33 +0100 Subject: [PATCH] Use a zipper instead of counting by hand. --- plugin/pythonhelper.vim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin/pythonhelper.vim b/plugin/pythonhelper.vim index 1832d42..8de8ef4 100644 --- a/plugin/pythonhelper.vim +++ b/plugin/pythonhelper.vim @@ -178,14 +178,11 @@ class SimplePythonTagsParser(object): # initalize local auxiliary variables {{{ tagsStack = [] - lineNumber = 0 # }}} + import itertools # go through all the lines in the source and localize all Python tags in it {{{ - for line in self.source: - - # increase line number - lineNumber += 1 + for (line, lineNumber) in zip(self.source, itertools.count(1)): # extract the line's indentation characters and its content {{{ lineMatch = self.COMMENTS_INDENT_RE.match(line)