I have no such problems;) At least I have them less often than extra, missing or shifted brackets or classics:
if (foo) bar(); baz();
in a language that uses braces.
It is said that some coding styles help. For example, I always list class variables at the top of the class body, so if I accidentally indent, I get an IndentationError instead of creating an unused local variable. By the way, I always saw it like that. Constant indentation (I'm with PEP 8 and use 4 spaces) also helps, some people use only one space for some blocks - this is very easy to overlook.
Analysis of static code (e.g. PyLint) may indicate such errors, but I do not have much experience with them. As I wrote, it just works most of the time.
source share