1

I'm doing a Python Project for homework and my my IDE (PyCharm) keeps telling me that my line is too long. I've done some research and I've found out that the rule is because of something called PEP8. However, I have not found a clear explanation of what PEP8 is, and I feel that understanding it may help with my programming ability. Can anyone help?

This question has been marked as duplicate so I'm going to explain how it is different. I have found that PEP8 wants you to make your lines shorter, but I wanted to know how it could benefit my programming skills. I know now, however, thanks to the help of an answer. I feel that I have learned something from this post, and so it should not be closed in case anyone has anything helpful to offer.

Ethan Wrightson
  • 149
  • 1
  • 5
  • 12
  • Maybe you should have googled "pep8" and read the first link that came up to figure out what it was. Do some research next time before asking. Duplicates like this just waste time and effort. – MattDMo Jan 14 '17 at 00:49

1 Answers1

9

Pep8 is a coding standard and Style Guide for readability and long-term maintainability. It's not a requirement for your code to work, just a good coding practice you should follow.

https://www.python.org/dev/peps/pep-0008/

There are also some automated tools you can use to help make your source code pep8 and other linters. Here's an example of one.

https://pypi.python.org/pypi/autopep8

Alexander Kleinhans
  • 5,950
  • 10
  • 55
  • 111
  • It may not be a requirement for your code to *work*, but some places may enforce coding standards making it a requirement anyway. – Mark Ransom Jan 13 '17 at 23:13
  • Thank you! I'll have a look at those links. – Ethan Wrightson Jan 14 '17 at 06:51
  • Also of note: PyCharm (a python IDE from JetBrains) added pep8 checking in early 2013, which is why the IDE is complaining to you when you violate those standards. See their blog posting from when this feature was announced (https://blog.jetbrains.com/pycharm/2013/02/long-awaited-pep-8-checks-on-the-fly-improved-doctest-support-and-more-in-pycharm-2-7/) for more info – Chuck van der Linden May 15 '18 at 21:04