On Sun, May 21, 2017 at 6:38 PM, Krishnakant <address@hidden> wrote:
The base is large enough, more than 1500 lines in a buffer (python module ).
That is a lot. See if any top-level functions or classes want to live
in separate modules.
There is a lot of nesting going on and we all know that we do get lost in
Do you have some solution?
Apply Torvalds’ razor: “if you need more than 3 levels of indentation,
you’re screwed[…], and should fix your program”.
See which deep-nested blocks carry out some action that could be given
a name. Extract those as functions. If you see a block of code with an
explanatory comment before it — that’s a function wanting to break
Also, The Zen of Python, item 5: “Flat is better than nested.”
See if you have this pattern:
if some condition:
Rewrite this to:
if not some condition:
Similarly with loops, using “continue”.
Sometimes replacing conditions with conditional expressions (x if y
else z) and loops with comprehensions and utility functions will do
wonders to your nesting levels.
Basically I have now figured out that spaces instead of tabs makes elpy work
fine with highlight-indentation-mode. So our team will have to switch to
using spaces again.
You use tabs with Python in a *team*?
Print out PEP8. Discuss it with your team. Unless you have good
reasons, format according to that. (Unfortunately, having lots of
existing code qualifies as “good reasons”.)