[RFC] checkpatch.py

Stefano Mioli jstevie at gmail.com
Sat Jul 4 07:41:29 CDT 2009


Martin Geisler wrote:

> The built-in enumerate function takes a sequence and add indices to it:
> 
>     >>> list(enumerate(["foo", "bar", "baz"]))
>     [(0, 'foo'), (1, 'bar'), (2, 'baz')]
> 
> You use it like this:
> 
>   for count, line in enumerate(lines):
>       # ...
> 
> Compared to your code this will count lines from zero instead of one, so
> you should add one when printing the line number.

Thank you Martin, this looks *way* more elegant.

I'll take your suggestion into account during the rewrite.

-- 
sm



More information about the Mercurial-devel mailing list