pylint woes

Chris Angelico rosuav at gmail.com
Sun May 8 00:21:49 EDT 2016


On Sun, May 8, 2016 at 2:10 PM, DFS <nospam at dfs.com> wrote:
>>> +-------------------------+------------+
>>> |trailing-whitespace      |59          | heh!
>>> +-------------------------+------------+
>>> |multiple-statements      |23          | do this to save lines.
>>>                                           Will continue doing it.
>>
>>
>> Why? Do you think that there's a world shortage of newline characters? Is
>> the Enter key on your keyboard broken?
>
>
> I do it because I like it.
>
> if verbose: print var
>
> python doesn't complain.

That's a massively-debated point. In that specific example, I'd
support the one-liner; however, I'd also recommend this technique:

# for Python 2, you need to start with this line
from __future__ import print_function

if verbose:
    verbiage = print
else:
    def verbiage(*args): pass

Then, instead of "if verbose: print(var)", you would use
"verbiage(var)". Of course, you want something better than "verbiage"
as your name; the nature of your verbose output might give a clue as
to what name would work.

ChrisA



More information about the Python-list mailing list