Le 23/11/2013 11:22, Nathann Cohen a écrit :
> The question is : how is it possible to break those cycles elegantly ?
> The only theoretically correct answer I have so far is to add a
> "parameter already_tried=[...]" containing the list of constructors that
> have been called already (*). So that you don't ask them back. Which
> means that there would be ugly "if OA not in already_tried: call OA"
> everywhere. Rather ugly.
> 
> Note that there is no specific need for speed in there. Building the
> object itself is quite long in some cases, and finding the function that
> contains the right implementation is rather negligible.
> 
> Thaaaaaaaaaaanks for your ideas :-P

Here is an idea:

(1) write the TD, OA and MOLS class standing on their own -- separate
from each other ;

(2) then create a function foo_builder which manages caches of what it
already built, and will depending on the parameters try to build one of
the TD, OA or MOLS object if it hasn't what it takes yet.

Snark on #sagemath

-- 
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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to