◐ Shell
clean mode source ↗

Message 45787 - Python tracker

Logged In: YES 
user_id=679426

It's an optimization: If we scroll up, we know that there
can't be a new context line with a smaller indentation than
that of the deleted context lines, so it lets us stop
searching sooner.

For example, take this class:

class Babonag(object):

    # This is a big class, and a lot of methods are defined
here...

    def ping():
        print "ping"

    def pong():
        pring "pong"

Now say we scroll up: the first line was 'print "pong"', and
it is now 'print "ping"'. If we use stopindent, we know that
we can stop immediately after we have reached "def ping",
because we know that there can't be a line with a smaller
indentation than that. If we don't, we have to scan up to
"class Babonag" to be certain that there aren't any extra
context lines.

(By the way, well done for the tweaked comments docstrings
and names. They seem a lot cleaner.)

Noam