I have recently started using Flake8 for syntax checking and have found that the style checking fails to check that `if __name__ == “__main__”:` after a class or function has the correct number of newlines preceding it. Shouldn’t this follow the same style rules as functions outside of a class? Jeff Janies
On Tue, Nov 5, 2013 at 10:28 AM, Jeff Janies
I have recently started using Flake8 for syntax checking and have found that the style checking fails to check that `if __name__ == “__main__”:` after a class or function has the correct number of newlines preceding it. Shouldn’t this follow the same style rules as functions outside of a class?
Hey Jeff! That may be an issue, I can not remember if the PEP specifies it or not off the top of my head, but let me give you some context (which you may already have): Flake8 wraps around 3 other tools: mccabe, pep8, and pyflakes. The behaviour you're seeing is coming from the pep8 tool. If PEP-008 (the document) specifies that this should be the case and using flake8 without any configuration does not warn you, then you should raise an issue on https://github.com/jcrocholl/pep8 Thanks for bringing this to our attention! -- Ian
Jeff Janies
I have recently started using Flake8 for syntax checking and have found that the style checking fails to check that `if __name__ == “__main__”:` after a class or function has the correct number of newlines preceding it.
Take care, when posting email, to use an editor that won't munge the text you're writing. Your message says “if __name__ == “__main__”:”, which is a SyntaxError. Easy enough to tell in this instance what you mean, but you should take care not to require *any* guessing on the part of the reader what exact code you are showing us. If you're using a tool that turns “"” into a different character, you need to avoid that tool when composing any messages about program code. -- \ “We now have access to so much information that we can find | `\ support for any prejudice or opinion.” —David Suzuki, 2008-06-27 | _o__) | Ben Finney
participants (3)
-
Ben Finney
-
Ian Cordasco
-
Jeff Janies