On Sat, Jun 4, 2016 at 6:11 PM, Kwankyu Lee <ekwan...@gmail.com> wrote:
> As the discussion of this thread seems to converge to the conclusion that we
> need to transfer the function of X.list() to X.elements() or like to avoid
> confusion, I still like to add to the following separate issue
>
>> >> (For matrix X), 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. So we can
>> > understand the current behavior as the "conversion" of a matrix.
>>
>>
>> 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?
>
>
> I think that list(X) is in general a way to get a "list" representation of
> object X. Then for matrix X, the list of rows of X is the closest
> representation since it keeps a bit of the structure of the matrix. So we
> can
>
> sage: m=matrix(2,[1,2,3,4])
>
> sage: m
>
> [1 2]
>
> [3 4]
>
> sage: list(m)
>
> [(1, 2), (3, 4)]
>
> sage: matrix(list(m))
>
> [1 2]
>
> [3 4]
>
> So I don't think the current behavior is so wrong.
> It is just unfortunate
> that X.list() and list(X) behave differently.

The current behavior is that X.list() returns [1,2,3,4], whereas
list(X) returns [(1,2),(3,4)].    It behaves as documented so it
is not "wrong".   I think it is extremely hard to argue that this
is not potentially very confusing to users and does not violate
a principle of list surprise.

A function like X.elements() that returns [1,2,3,4] would make
perfect sense.  In fact, Sage's X.list() exists because I was
implementing something like Magma's EltSeq function, and Eltseq
is a lot closer to .elements() than .list().   I messed up.

William


>
> --
> 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.



-- 
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.

Reply via email to