Speed up lights-out variant solver in pure Python
You have a matrix of bits. You could represent each row by a single integer. (Remember that in Python the size of int is unlimited, so working with 255 bits is not a problem.)  Then you would be able to avoid the inner loop here

for row in xrange(pivotRow + 1, n):
    if toggle[row][col]:
        for i in xrange(len(toggle[row])):
            toggle[row][i] ^= toggle[nextFreeRow][i]


and do this instead

col_mask = 1 &lt;&lt; col
for row in xrange(pivotRow + 1, n):
    if toggle[row] &amp; col_mask:
        toggle[row] ^= toggle[nextFreeRow]