Most of these extra spaces do not agree with pep8. Granted that it should be xrange(A.shape[0]-1, -1, -1), but the spaces inside the braces for indexing should not be there.
http://www.python.org/dev/peps/pep-0008/#other-recommendations
Look at what it says about spaces inside lower-priority operators.