1
0
mirror of https://github.com/gryf/pythonhelper.git synced 2025-12-18 20:10:24 +01:00

Use a zipper instead of counting by hand.

This commit is contained in:
cheater
2012-02-08 08:14:33 +01:00
committed by cheater
parent 702b07e390
commit 0cccd82b2a

View File

@@ -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)