Checking if an array is unimodal
The following code is similar to your method 2:

def is_unimodal(seq):
    i = 1
    end = len(seq)
    while i &lt; end and seq[i - 1] &lt; seq[i]:
        i += 1
    while i &lt; end and seq[i - 1] == seq[i]:
        i += 1
    while i &lt; end and seq[i - 1] &gt; seq[i]:
        i += 1
    return i == end


This code probably looks more like C than Python, but I expect it to be fast and readable.