PEP8 and 4 spaces

Peter Otten __peter__ at web.de
Thu Jul 3 19:57:37 CEST 2014


Tobiah wrote:

> Coworker takes PEP8 as gospel and uses 4 spaces
> to indent.  I prefer tabs.  Boss want's us to
> unify.  The sole thing you get with spaces as
> far as I can tell, is that someone loading the
> code into Notepad will still see a 4 character
> indent.  That may be true, but that same person
> is going to have a difficult time editing the
> code.
> 
> Anyway, I gave up the 80 char line length long
> ago, having little feeling for some dolt on
> a Weiss terminal that for some reason needs to
> edit my code.  I feel rather the same about the
> spaces and tabs, given that most people seem to
> be using editors these days that are configurable
> to show tabs a four characters.
> 
> Any evidence out there that this part of PEP8 is becoming
> more optional or even obsolete, as I've heard others
> say about the 80 char line length?
> 
> Just need ammo for when the hammer of code
> unification comes down.

Indentation: more important than what convention is chosen is that a
convention is chosen. Relax and follow your collegue's example.

As to the line length: how do you manage to exceed the 80-char limit? Deep
nesting, long variable names, complex expressions? All of these often make
it worthwhile refactoring the code even with a lot of horizonal space left
blank on the monitor.

Also: you can probably come up with five aspects that affect the quality of 
your company's code more than the above superficial points and that are hard 
to fix. So pick your fights and attack the most relevant issue.




More information about the Python-list mailing list