On Jun 3, 4:47 pm, Jason Grout <jason-s...@creativetrax.com> wrote: > I don't know that it will make much difference to look into exactly why > the M.list() method doesn't exist anymore, given that list(M) seems to > be equivalent. However, looking into this might uncover a place where a > deprecation warning should have been placed to warn users who used M.list().
The mechanisms are different. For list(M), one only needs that M has an iter() method, whereas M.list() is simply a method on M. By default I'd say that list(M) would be the more pythonic and hence preferred method. However, the referee of #10470 has a different opinion. In http://trac.sagemath.org/sage_trac/attachment/ticket/10470/trac_10470-referee-doc.patch It is claimed that M.list() is preferable for for sage objects. Possible reasons for this are: - It allows raising an error rather than infinite iteration if M is iterable but not finite. - It is conceivable that if one really needs M.list(), it can be more efficient to produce this in one go than with an iterator. On the other hand, objects implementing the iterator protocol are more versatile so in general they should probably do that before providing a .list() method. If we should indeed prefer M.list() over list(M), perhaps we should provide a list method on SageObject that just returns list(self)? That way objects are OK if they just provide .iter(), but if producing a list efficiently is desirable for that object, the .list method can be overridden. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org