On Dec 15, 3:17 am, leif <not.rea...@online.de> wrote:
> +1
>
> There's a slight difference between infinite and [non-]enumerable sets
> you know...  ;-)

Right.  ;-)  What I would like to prevent is a hang when naively
asking for the *entire* list of elements of an infinite set, without
having to know (or investigate beforehand) that the set is infinite.
I understand the desire and need for iterators for these sets, as
Robert described.  Despite appearances, I wasn't proposing killing
that behavior.

A quick experiment would indicate that checking if a set knows it is
infinite early in  _list_from_iterator_cached  will prevent most
simple/obvious cases of these hangs without breaking anything else.
I'll put up a real patch for consideration soon.

> What about requiring a 'count' parameter to .list() if [we know that]
> the set is not finite?

I'd think that If someone wants a handful of elements from a set they
know is infinite, then they should construct the iterator (which the
list-building routine is using anyway) and just get their elements
from that?  A count keyword would be useful, though then the caching
behavior of these lists might need to be refined.

Rob

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

Reply via email to