pylint scores
News123
news1234 at free.fr
Fri Jul 30 15:18:15 EDT 2010
On 07/30/2010 03:12 PM, wheres pythonmonks wrote:
> I am starting to use pylint to look at my code and I see that it gives a rating.
> What values do experienced python programmers get on code not
> targeting the benchmark?
>
> I wrote some code, tried to keep it under 80 characters per line,
> reasonable variable names, and I got:
>
> 0.12 / 10.
>
> Is this a good score for one not targeting the benchmark? (pylint
> running in default mode)
>
It's not a goodf core, but arrives easily if you never ran pylint before.
With very little effort you should be able to be above 5
with a little more effort above 7
> Somewhat related: Is the backslash the only way to extend arguments
> to statements over multiple lines? (e.g.)
if you have an opening parenthesis, or bracked, then you don't need a
backslash
so instead of
if longlonglonglonglonglonglonglongvar == \
otherlonglonglonglongvar:
you could also write:
if (longlonglonglonglonglonglonglongvar ==
otherlonglonglonglongvar):
same works of course with asserts.
>
>>>> def f(x,y,z): return(x+y+z);
> ...
>>>> f(1,2,
> ... 3)
> 6
>>>> assert f(1,2,3)>0,
> File "<stdin>", line 1
> assert f(1,2,3)>0,
> ^
> SyntaxError: invalid syntax
>>>>
>
> In the above, I could split the arguments to f (I guess b/c of the
> parens) but not for assert. I could use a backslash, but I find this
> ugly -- it that my only (best?) option?
>
> [I really like to assert my code to correctness and I like using the
> second argument to assert, but this resulted in a lot of long lines
> that I was unable to break except with an ugly backslash.]
>
> W
More information about the Python-list
mailing list