On Thu, Jun 2, 2016 at 9:45 PM, Kwankyu Lee <ekwan...@gmail.com> wrote: >> Suppose that our object X has a basis consisting of four 2x2 matrices, >> in some abstract sense. Then your >> >> X.list() >> >> might very well return a tuple of four *mutable* 2x2 matrices. Then >> this X.tuple() is still very much mutable, and the original problem >> has not been solved. I guess that's my point. > > > I am inclined to agree with Volker. Returning a tuple from X.list() would be > one basic device to help not accidentally change the list of the elements of > X, though it is not a bulletproof one. > >> Making list(X) and X.list() return different things definitely >> violates the "principle of least surprise". > > > Is that list(X) returns a list while X.list() returns a tuple so surprising? > The former can be seen as a "conversion" from X to a list , like > list((1,2,3)), while the latter is a command to list elements of X, as > Volker said.
You guys are just trying to make Sage confusing. Try explaining this choice in front of 50 people learning Sage. >> I made this mistake once >> before with matrices, in which X.list() returns a list of all the >> entries of the matrix, whereas list(X) returned the rows. This is >> totally my fault, definitely wrong, and its' in Sage right now. > > > The list of the rows of X is the closest thing to X. Huh? Isn't the list of columns isn't just as close? What about the list of all elements? What metric for closeness are you using? > So we can understand > the current behavior as the "conversion" of a matrix. The current behavior of X.list() is to return a list of all the *elements* of the matrix. Not of the rows or the columns. However list(X), sadly, returns something different. People have -- over the years -- repeatedly been very annoyed by this dumb design choice that I made. This list --> tuple change is just going to cause even more similar pain down the road later. Just implement GF(5).list() properly. -- William -- William (http://wstein.org) -- 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 post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.