You are probably using Sage with Python 2. In Python 2, a list expression involving an index variable `a` like
assume([U_asm[a] for a in [0, 1, 3]]) overwrites the previous content of the variable `a`. At the end of the loop, `a` will have the value `3`, which leads to the output you obtained. If you rename the loop index to something other than a,b,c,d, the problem goes away. With Python 3, this problem does not exist either, as loop variables are local as one would expect. Therefore, I suggest to switch to using Sage with Python 3. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/0cb37fb2-c5fd-4a57-9574-4d674ef7698a%40googlegroups.com.