Re: [sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-23 Thread Sébastien Labbé
On Tuesday, August 23, 2016 at 10:16:53 AM UTC+2, Salvatore Stella wrote: > > Indeed RecursivelyEnumeratedSet seems to be a good fit for my needs. > The only problem I encountered so far is that it does not handle > KeybordInterrupts nicely either: if you interrupt the computation of > graded_c

Re: [sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-23 Thread VulK
Indeed RecursivelyEnumeratedSet seems to be a good fit for my needs. The only problem I encountered so far is that it does not handle KeybordInterrupts nicely either: if you interrupt the computation of graded_component(n) then graded_component(m) with m [2016-08-23 00:51:34]: > > Are you rea

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-23 Thread Sébastien Labbé
> > > Are you really getting benefit from storing the state (i.e., the actual > > iterator) on the parent itself? (I see you haven't made ClusterAlgebra > > UniqueRepresentation, so it's not an immediate bug to have it this way) > > Perhaps it's cleaner to hand out iterator objects that are ke

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread VulK
Hi All, thank you very much for all the inputs! > Breath-first search = Search & pray? ;-) > > (Possibly infinite apnoea can't be healthy.) /me fails :) > Well, one usually implements checkpoints for such things (continually > saving state to optionally resume later if interrupted). I am not s

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Sébastien Labbé
sage: RecursivelyEnumeratedSet? > See also http://doc.sagemath.org/html/en/reference/structure/sage/sets/recursively_enumerated_set.html If the structure of your set is a tree or forest, then you may be interested in using parallel computations on your structure provided by http://doc.sagema

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Sébastien Labbé
Do you know about sage: RecursivelyEnumeratedSet? -- 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,

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Volker Braun
On Monday, August 22, 2016 at 8:27:28 PM UTC+2, Nils Bruin wrote: > > Iterators themselves are required to be "iterable", but in a strange way: > calling "iter" on an iterators gives you back an identical object! In > particular, if I is an iterator then calling next(I) and next(iter(I)) > shoul

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Nils Bruin
On Monday, August 22, 2016 at 10:53:23 AM UTC-7, Volker Braun wrote: > IMHO iterators must not have global state, which is really just a > corollary to "global variables are bad". In particular, iterating twice > simultaneously should work. With the exception of input iterators of > course, but

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Volker Braun
On Monday, August 22, 2016 at 6:12:50 PM UTC+2, Nils Bruin wrote: > > Perhaps it's cleaner to hand out iterator objects that are kept track of > in the relevant loop. That iterator would then just die whenever the frames > of a KeyboardInterrupt exception are discarded and the flawed state > wou

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread Nils Bruin
On Monday, August 22, 2016 at 12:42:26 AM UTC-7, Salvatore Stella wrote: > > At the moment the init function of :class:`ClusterAlgebra` calls > :meth:`reset_exploring_iterator` that creates an instance of :meth:`seeds` > and > stores it in an internal var ``_sd_iter``. Are you really getting

[sage-devel] Re: Iterators and KeyboardInterrupt

2016-08-22 Thread leif
VulK wrote: > Dear All, > in a ticket (#21254) I recently created with Dylan Rupel I need to explore a > (possibly) infinite n-regular tree in a breath-first search. Breath-first search = Search & pray? ;-) (Possibly infinite apnoea can't be healthy.) > The way it is > implemented right now is