Okay here's where I think we are, and my 2 cents in the matter.

Simon wants to have a database which stores the map information which is 
constructed by the decorator @combinatorial_map in order to not have it 
cause any slowdowns. The question is, "how to do this?"

Here's my 2 cents of a solution. The first time the object is called when 
we want to get the map info, have it iterate over all it's methods and call 
any method wrapped in @combinatorial_map. The decorator then does:

def combinatorial_map(f):
    # Check if the object's class and the method's name is in the database;
    #   this might not be the right python
    if (f.self.__class__, f.__name__) in DATABASE:
        DATABASE.add(...)
    return f

This has the advantage of being dynamic, so it shouldn't hamper startup 
time, and only occurs the first time the object is created, so repeated 
uses won't be slow. We could also go one small step further and have an 
(cython) ABC which does this behavior on initialization.

Best,
Travis

-- 
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/d/optout.

Reply via email to