Hi there!

I tried to improve on my FindStat interface 
(trac.sagemath.org/ticket/17818), by making the instances of the class 
FindStatMap elements of a new class FindStatMaps.

I used the pattern below (reduced to an absolute minimum.  I must admit, 
this is a lot of code for saying that a FindStatMap has a parent):

Now, if you look hard enough, you'll find three question marks in 
FindStatMaps.__init__.

My question, is, what should I put there?  Mathematically, FindStatMaps are 
morphisms in the category FiniteEnumeratedSets.  They have a domain (which 
is an element of FindStatCollections, such as DyckWords or Graphs) and a 
codomain, and it would actually be nice if we could compose them.

Or should I be doing something completely different?

Best,

Martin

class FindStatMap(Element):
    __metaclass__ = ClasscallMetaclass
    @staticmethod
    def __classcall_private__(cls, entry):
        """
        Retrieve a map from the database.
        """
        return FindStatMaps()(entry)

    def __init__(self, parent, entry):
        self._map = entry
        Element.__init__(self, parent)

# a few methods describing a map, like domain, codomain, name.
...
        
class FindStatMaps(Parent, UniqueRepresentation):
    def __init__(self):
        """
        Fetch all the maps from FindStat.

        TESTS::

            sage: from sage.databases.findstat import 
FindStatMaps              
            sage: M = 
FindStatMaps()                                            # optional -- 
internet
            sage: 
TestSuite(M).run()                                            # optional -- 
internet
        """
        self._findstat_maps = 
json.load(urlopen(FINDSTAT_URL_DOWNLOADS_MAPS))
        Parent.__init__(self, category=???)

    def _element_constructor_(self, entry):
        """Initialize a FindStat map.

        INPUT:

        - ``entry`` -- a string containing the FindStat name of the
          map, or an integer giving its id, or a dict containing all
          the information.

# very few methods
...

    Element = FindStatMap

-- 
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 [email protected].
To post to this group, send email to [email protected].
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