It's not clear what "list(DM)" actually means. It used to mean: get the nonzero elements of the DM matrix. But it could also mean, get a list with [1,2,3]. But DM is a matrix type, so maybe you want a list of lists: [[1],[2],[3]]? In CasADi 3, we decided to avoid the confusion by requiring the user to specify what kind of conversion he/she wants. So:
print a.nonzeros() # if you want the nonzeros, equivalent to list(a) before
print a.full() # if you want a dense numpy matrix
print a.sparse() # if you want a sparse scipy matrix
Joel