On Monday, November 18, 2013 2:04:18 AM UTC-8, John Cremona wrote:
>
> I discovered the same difference between M.list() and list(M) when
> formulating my reply. It seems that list(M) is the same as M.rows()
> rather than M.list(), but I don't know why it was implemented this
> way. It may just be an accident, since list(M) calls the python
> function list() and what that does with an object depends on the
> object's structure somehow. You can also see from M.rows?? that
> M.rows() calls list(M).
>
The default that
for v in M:
... do something with v
iterates over the rows of M is very convenient in a lot of places. I think
that is a more common operation than iterating over the entries. That
list(M) returns a list of rows (the same as M.rows()) is a corollary of
that. In that perspective, M.list() is perhaps unfortunately named
(M.entries() perhaps? If we add the alias I think people will still wonder
about list)
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.