         # true if we should have a hanging indent, false otherwise
         shouldHang = false
 
-        # this is the last defined function row
-        lastLastFunctionRow = lastFunctionRow
+        # this is the last defined def/for/if/elif/else/try/except row
+        lastlastColonRow = lastColonRow
 
         for col in [0 .. line.length - 1] by 1
             c = line[col]


                    # Similar to above, we've already skipped all irrelevant characters,
                    # so if we saw a colon earlier in this line, then we would have
                    # incorrectly thought it was the end of a function definition when
                    # it was actually a dictionary being defined, reset the lastFunctionRow
                    # variable to whatever it was when we started parsing this line.
                    lastFunctionRow = lastLastFunctionRow

                    if c == ':'
                        lastFunctionRow = row
                    else if c in '})]' and openBracketStack.length
                        # Note that the .pop() will take the element off of the openBracketStack
                        # as it adds it to the array for lastClosedRow.

    # i.e., did this string start with ' or with "?
    stringDelimiter = []
    # this is the row of the last function definition
    lastColonRow = NaN

    # NOTE: this parsing will only be correct if the python code is well-formed
    #       statements like "[0, (1, 2])" might break the parsing
