pep8

Why should Python PEP-8 specify a maximum line length of 79 characters?

Why in this millenium should Python PEP-8 specify a maximum line length of 79 characters? Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the choice of the content consumer, not the responsibility of the content creator. Are there any (legitimately) good reasons for adhering to 7...

How to integrate pep8.py in Eclipse?

A little background: PEP 8 is the Style Guide for Python Code. It contains the conventions all python programmers should follow. pep8.py is a (very useful) script that checks the code formating of a given python script, according to PEP 8. Eclipse is a great IDE. With the Pydev extension, it that can be used to develop Python I run p...

Clashing guidelines

While coding in Python it's better to code by following the guidelines of PEP8. And while coding for Symbian it's better to follow its coding standards. But when I code for PyS60 which guidelines should I follow? Till now I have been following PEP8, but this code shows the opposite. Do I need to rework my code? ...

How can I use Emacs Flymake mode for python with pyflakes and pylint checking code?

For checking code in python mode I use flymake with pyflakes Also I want check code style (pep8) with pylint (description on the same page with pyflakes) This solutions work. But I can't configure flymake for work with pyflakes and pylint together. How can I do it? ...

Python PEP8 printing wrapped strings without indent

There is probably an easy answer for this, just not sure how to tease it out of my searches. I adhere to PEP8 in my python code, and I'm currently using OptionParser for a script I'm writing. To prevent lines from going beyond a with of 80, I use the backslash where needed. For example: if __name__=='__main__': usage = '%prog [op...

PyLint, PyChecker or PyFlakes ?

I would like to get some feedback on these tools on : features; adaptability; ease of use and learning curve. ...

Python: imports at the beginning of the main program & PEP 8

The PEP 8 recommends that modules be imported at the beginning of programs. Now, I feel that importing some of them at the beginning of the main program (i.e., after if __name__ == '__main__') makes sense. For instance, if the main program reads arguments from the command line, I tend to do import sys at the beginning of the main progr...

For what reason do we have the lower_case_with_underscores naming convention?

Depending on your interpretation this may or may not be a rhetorical question, but it really baffles me. What sense does this convention make? I understand naming conventions don't necessarily have to have a rhyme or reason behind them, but why deviate from the already popular camelCase? Is there a rhyme and reason behind lower_case_with...

PEP8 - 80 Characters - Big Strings

Due to the sheer annoyance of figuring out what to Google, I've decided to risk what any reputation I had to ask this rather simple question. As PEP8 suggests keeping below the 80 column rule for your python program, how can I abide to that with long strings, i.e. s = "this is my really, really, really, really, really, really, really l...

PEP8 - 80 Characters - Big Integers

This is somehow related to question about big strings and PEP8. How can I make my script that has the following line PEP8 compliant ("Maximum Line Length" rule)? pub_key = { 'e': 3226833362680126101036263622033066816222202666130162062116461326212012222403311326222666622610430466620224662364142L, 'n': 22642100386104124846282622610...

How can I make my Python code stay under 80 characters a line?

I have written some Python in which some lines exceed 80 characters in length, which is a threshold I need to stay under. How can I adapt my code to reduce line lengths? ...

How to break the following line of python

Hello Stack Overflow, I have come upon a couple of lines of code similar to this one, but I'm unsure how I should break it: blueprint = Blueprint(self.blueprint_map[str(self.ui.blueprint_combo.currentText())], runs=self.ui.runs_spin.text(), me=self.ui.me_spin.text(), pe=self.ui.pe_skill_combo.currentIndex()) Thanks in advance ...

Does python import all the listed libraries?

Hi folks, I'm just wondering, I often have really long python files and imports tend to stack quite quickly. PEP8 says that the imports should always be written at the beginning of the file. Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called? Does it m...

Do you know any style guide for Python?

Do you know any style guide for Python like "Code Like a Pythonista"? I found chapter 2.3.4 of Expert Python Programming very interesting too. ...

Python PEP8: Blank lines convention.

Hi. I am interested in knowing what is the Python convention for new lines between the program? For example, consider this: import os def func1(): def func2(): What should be the ideal new line separation between: the import modules and the functions? the functions themselves? I have read PEP8, but I wanted to confirm the abov...

Configuring pep8 in Textmate

Textmate has a Python PEP8 bundle that will run pep8 validation on your file. How can I set it to do the equivalent of pep8 --ignore=E501 my_file.py? ...

Python Language Nuances

Possible Duplicate: Common Pitfalls in Python I'm learning Python and I come from a diverse background of programming languages. In the last five years, I've written quite a bit of Java, C++, VB.Net, and PHP. As many of you might agree, once you learn one programming language, learning another is just a mater of learning the d...

PEP8 and PyQt, how to reconcile

I'm starting to use PyQt in some projects and I'm running into a stylistic dilemma. PyQt's functions use camel case, but PEP8, which I prefer to follow, says to use underscores and all lowercase for function names. So on the one hand, I can continue to follow PEP8, meaning that my code will have mixed functions calls to camel case and ...

Current Status of PEP 8 Rules?

Are all PEP 8 rules still valid? Are there any which are obsolete? Isn't there a more explanatory cheat sheet that this one. ...

What PEP 8 guidelines do you ignore, and which ones do you stick to?

The title says most of it really :) Over the years, the more Python I write, the more I find myself agreeing with most of the guidelines, some though I consistently and intentionally break for my own reasons. I'd be curious to know what in PEP 8 (or other PEPs too maybe) people religiously stick to and why, and what people find inconven...