#13566: Simplicial complex examples as singletons
---------------------------------------------------+------------------------
       Reporter:  tscrim                           |         Owner:  tscrim     
     
           Type:  enhancement                      |        Status:  needs_work 
     
       Priority:  minor                            |     Milestone:  sage-5.6   
     
      Component:  algebraic topology               |    Resolution:             
     
       Keywords:  simplicial                       |   Work issues:             
     
Report Upstream:  N/A                              |     Reviewers:  Travis 
Scrimshaw
        Authors:  Christian Nassau, John Palmieri  |     Merged in:             
     
   Dependencies:  #13244, #12587                   |      Stopgaps:             
     
---------------------------------------------------+------------------------

Comment (by SimonKing):

 Sorry, I did not read the whole discussion, but I see in the patch that
 cached_method is used. Hence, the constructed simplicial complexes will be
 kept in memory indefinitely. Wouldn't it be a better idea to turn
 simplicial_complexes into a `UniqueFactory`?

 Of course, in a `UniqueFactory` one would usually ask for a Klein bottle
 by `simplicial_complexes("KleinBottle")`. But of course one could still
 define methods `KleinBottle` and so on, so that
 `simplicial_complexes.KleinBottle()` is equivalent to
 `simplicial_complexes("KleinBottle")`.

 The latter could be automatised by a `__getattr__` method:
 {{{
     def __getattr__(self, s):
         return lambda : self(s)
 }}}

 Why would that solve the problem with permanent caching? Well,
 `UniqueFactory` will soon be using weak dictionaries for caching (in fact
 it already uses weak references, but improperly, and that's supposed to be
 fixed in #12215).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13566#comment:23>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to