PEP8: conflict between W292 and W391

Posted by seler on Stack Overflow See other posts from Stack Overflow or by seler
Published on 2012-03-19T09:58:00Z Indexed on 2012/03/19 10:03 UTC
Read the original article Hit count: 263

Filed under:
|

As far as I know in unix it's a good practice to always have blank line at the end of file - or to put it in other words: every line should end with \n.

While checking my python code with PEP8 I noticed that it also states that there should be \n at end of file:

W292 no newline at end of file
    JCR: The last line should have a newline.

What's strange, it conflicts with W391:

W391 blank line at end of file
    JCR: Trailing blank lines are superfluous.

    Okay: spam(1)
    W391: spam(1)\n

How it should be? Should I have blank line at the end of file or not?

© Stack Overflow or respective owner

Related posts about python

Related posts about pep8