# HG changeset patch
# User Simon King <simon.king@unijena.de>
# Date 1345141378 7200
# Node ID 6658e3bc3e1f9c6d8eb2176895842e4ef04d4484
# Parent 8a55ce250af80970145c467e6a35bf6794800218
#715: Documentation of TripleDict
diff git a/doc/en/reference/structure.rst b/doc/en/reference/structure.rst
a

b


9  9  sage/structure/parent_old 
10  10  sage/structure/parent_base 
11  11  sage/structure/parent_gens 
 12  sage/structure/coerce_dict 
12  13  sage/structure/formal_sum 
13  14  sage/structure/factorization 
14  15  sage/structure/element 
diff git a/sage/structure/coerce_dict.pyx b/sage/structure/coerce_dict.pyx
a

b


1  1  #***************************************************************************** 
2  2  # Copyright (C) 2007 Robert Bradshaw <robertwb@math.washington.edu> 
3   # 2011 Simon King <simon.king@unijena.de> 
 3  # 2012 Simon King <simon.king@unijena.de> 
4  4  # 
5  5  # Distributed under the terms of the GNU General Public License (GPL) 
6  6  # 
7  7  # http://www.gnu.org/licenses/ 
8  8  #***************************************************************************** 
 9  """ 
 10  Containers for storing coercion data 
9  11  
 12  This module provides :class:`TripleDict`. It is a structure similar to 
 13  ``WeakKeyDictionary`` in Python's weakref module, and is optimized for lookup 
 14  speed. Keys consist of a triple (k1,k2,k3) and are looked up by identity 
 15  rather than equality. The keys are stored by weakrefs if possible. If any 
 16  one of the components k1, k2, k3 gets garbage collected, then the entry is 
 17  removed from the :class:`TripleDict`. 
10  18  
 19  Key components that do not allow for weakrefs are stored via a normal 
 20  refcounted reference. That means that any entry stored using a triple 
 21  (k1,k2,k3) so that none of the k1,k2,k3 allows a weak reference behaves 
 22  as an entry in a normal dictionary: Its existence in :class:`TripleDict` 
 23  prevents it from being garbage collected. 
 24  
 25  That container currently is used to store coercion and conversion maps 
 26  between two parents (:trac:`715`) and to store homsets of pairs of objects 
 27  of a category (:trac:`11521`). In both cases, it is essential that the parent 
 28  structures remain garbage collectable, it is essential that the data access 
 29  is faster than with a usual ``WeakKeyDictionary``, and we enforce the "unique 
 30  parent condition" in Sage (parent structures should be identical if they are 
 31  equal). 
 32  """ 
11  33  include "../ext/python_list.pxi" 
12  34  
13  35  from sage.misc.constant_function import ConstantFunction 