Slight stylistic thing.. I really dislike the \ character to continue lines. They're pretty much entirely unnecessary in python since you can instead use parens:

    if (a and
        b):

Works fine. Same for `step =` below.