Theano logistic regression understanding code
I agree the code may be hard to read at the first glance, but I find the comment pretty clear:


y.shape[0] is (symbolically) the number of rows in y, i.e., number of examples (call it n) in the minibatch 
T.arange(y.shape[0]) is a symbolic vector which will contain [0,1,2,... n-1].
T.log(self.p_y_given_x) is a matrix of Log-Probabilities (call it LP) with one row per example and one column per class 
LP[T.arange(y.shape[0]),y] is a vector v containing [LP[0,y[0]], LP[1,y[1]], LP[2,y[2]], ..., LP[n-1,y[n-1]]]
T.mean(LP[T.arange(y.shape[0]),y]) is the mean (across minibatch examples) of the elements in v, i.e., the mean log-likelihood across the minibatch. 


Everything is Python notation (but sometimes using Theano functions).