Ticket #3738: 3738-referee-comments.patch

File 3738-referee-comments.patch, 6.0 KB (added by robertwb, 11 years ago)
  • sage/structure/category_object.pyx

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1218694175 25200
    # Node ID a187478ae74f1aea18803f8732db57ba7fb3dd19
    # Parent  799910270fc30be99a31c9831462b7b6e6562a7d
    Respond to Robert Miller's comments.
    
    diff -r 799910270fc3 -r a187478ae74f sage/structure/category_object.pyx
    a b cdef class CategoryObject(sage_object.Sa 
    335335        equal to the generators of self.
    336336
    337337        NOTE: If Foo is a constructor for a SAGE object with
    338         generators, and Foo is defined in Pyrex, then it would
     338        generators, and Foo is defined in Cython, then it would
    339339        typically call inject_variables() on the object it
    340340        creates.  E.g., PolyomialRing(QQ, 'y') does this so that the
    341341        variable y is the generator of the polynomial ring.
    cdef class CategoryObject(sage_object.Sa 
    497497
    498498    #################################################################################
    499499    # Give all objects with generators a dictionary, so that attribute setting
    500     # works.   It would be nice if this functionality were standard in Pyrex,
     500    # works.   It would be nice if this functionality were standard in Cython,
    501501    # i.e., just define __dict__ as an attribute and all this code gets generated.
    502502    #################################################################################
    503503    def __getstate__(self):
  • sage/structure/coerce_actions.pyx

    diff -r 799910270fc3 -r a187478ae74f sage/structure/coerce_actions.pyx
    a b cdef class RightModuleAction(ModuleActio 
    190190       
    191191    cpdef Element _call_(self, a, g):
    192192        """
    193         A rikght module action is an action that takes the module element as the
     193        A right module action is an action that takes the module element as the
    194194        first argument (the left side) and the ring element as the second
    195195        argument (the right side).
    196196       
    cdef class RightModuleAction(ModuleActio 
    217217            else:
    218218                return _lmul_c(<ModuleElement>a, <RingElement>g)  # a * g
    219219        else:
     220            # If we have few enough references to this object, then we know
     221            # it is safe to do a (mutating) inplace operation.
    220222            if (<RefPyObject *>a).ob_refcnt < inplace_threshold + self.is_inplace:
    221223                return _ilmul_c(<ModuleElement>a, <RingElement>g)  # a * g
    222224            else:
  • sage/structure/coerce_maps.pyx

    diff -r 799910270fc3 -r a187478ae74f sage/structure/coerce_maps.pyx
    a b cdef class DefaultConvertMap(Map): 
    5858
    5959cdef class DefaultConvertMap_unique(DefaultConvertMap):
    6060    """
    61     This morphism simply differs action to the codomain's element_constructor method,
     61    This morphism simply defers action to the codomain's element_constructor method,
    6262    WITHOUT passing in the codomain as the first argument.
    6363
    6464    This is used for creating elements that don't take a parent as the first argument
  • sage/structure/parent.pyx

    diff -r 799910270fc3 -r a187478ae74f sage/structure/parent.pyx
    a b cimport element 
    1616cimport element
    1717cimport sage.categories.morphism as morphism
    1818cimport sage.categories.map as map
     19
     20import copy
    1921
    2022cdef int bad_parent_warnings = 0
    2123cdef int unique_parent_warnings = 0
    cdef class Parent(category_object.Catego 
    253255        This is the generic call method for all parents.
    254256       
    255257        When called, it will find a map based on the Parent (or type) of x.
    256         If a coercion exists, this it will always be chosen. This map will
     258        If a coercion exists, it will always be chosen. This map will
    257259        then be called (with the arguments and keywords if any).
    258260       
    259261        By default this will dispatch as quickly as possible to
    cdef class Parent(category_object.Catego 
    594596        if not PY_TYPE_CHECK(convert_list, list):
    595597            raise ValueError, "%s_populate_coercion_lists_: convert_list is type %s, must be list" % (type(convert_list), type(self))
    596598
    597         self._initial_coerce_list = coerce_list
    598         self._initial_action_list = action_list
    599         self._initial_convert_list = convert_list
     599        self._initial_coerce_list = copy(coerce_list)
     600        self._initial_action_list = copy(action_list)
     601        self._initial_convert_list = copy(convert_list)
    600602       
    601603        self._convert_method_name = convert_method_name
    602604        if init_no_parent is not None:
    cdef class Parent(category_object.Catego 
    744746        """
    745747        # We first check (using some cython trickery) to see if coerce_map_from_ has been overridden.
    746748        # If it has, then we can just (by default) call it and see if it returns None or not.
    747         # Otherwise we return False by default (so that no canonical coercions exist)
     749        # Otherwise the default would call this function again, so we we return False by default
     750        # (so that no canonical coercions exist)
    748751        if HAS_DICTIONARY(self):
    749752            method = (<object>self)._coerce_map_from_
    750753            if PyCFunction_Check(method) and \
    cdef class Parent(category_object.Catego 
    836839                    - DefaultConvertMap_unique
    837840                    - NamedConvertMap
    838841                return this map
    839             3. Traverse the coercion lists looking for the "best" map
    840                (including the one found at 2).
     842            3. Traverse the coercion lists looking for another map
     843               returning the map from step (2) if none is found.
     844               
     845        In the future, multiple paths may be discovered and compared.
    841846        """
    842847        best_mor = None
    843848        if PY_TYPE_CHECK(S, Parent) and (<Parent>S)._embedding is not None: