# HG changeset patch # User Aurelien Campeas # Date 1392498532 -3600 # Sat Feb 15 22:08:52 2014 +0100 # Node ID 2a6d4117233594c07d9253997cb9618247183162 # Parent ef5fcae868e0f5aeb3add482cdc191afc18ff335 doc: add a small bibliography diff --git a/dispatch.py b/dispatch.py --- a/dispatch.py +++ b/dispatch.py @@ -4,6 +4,7 @@ return mro.index(klass) def check_ambiguity(candidates, mros): + """ GvR's ambiguity checking """ def dominates(dom, sub, orders=tuple(dict((t, i) for i, t in enumerate(mro)) for mro in mros)): @@ -16,6 +17,7 @@ for dom, _func in candidates)] def clos_mro(types_func_map, callsig): + """ David Mertz's clos mro """ siglen = len(callsig) table = [(sig, func) for sig, func in types_func_map.iteritems() if len(sig) == siglen @@ -31,6 +33,13 @@ class NoNextMethod(Exception): pass class GF(object): + """ primary methods + TODO: + before/after/around + all before get executed first, bottom to top + all after get executed last, top to bottom + """ + def __init__(self, mro=clos_mro): self.mro = mro self._reg = {} diff --git a/doc/biblio.txt b/doc/biblio.txt new file mode 100644 --- /dev/null +++ b/doc/biblio.txt @@ -0,0 +1,41 @@ + +Python 3000 - Adaptation or Generic Functions? +by Guido van van Rossum +April 5, 2006 +http://www.artima.com/weblogs/viewpost.jsp?thread=155123 + +PEP: 3124 +Title: Overloading, Generic Functions, Interfaces, and Adaptation +http://www.python.org/dev/peps/pep-3124/ + +CLOS +http://en.wikipedia.org/wiki/CLOS + +Generic Function +http://en.wikipedia.org/wiki/Generic_function + +The Common Lisp Object System: An Overview by Richard P. Gabriel and Linda DeMichiel +http://www.dreamsongs.com/NewFiles/ECOOP.pdf + +Generic functions vs mixins: a case study +by Michele Simionato +September 3, 2008 +http://www.artima.com/weblogs/viewpost.jsp?thread=237764 + +Mixins considered harmful/1 +by Michele Simionato +January 1, 2009 +http://www.artima.com/weblogs/viewpost.jsp?thread=246341 + +Mixins considered harmful/2 +by Michele Simionato +January 5, 2009 +In this post I clarify my position with respect to mixins, I show a few common design mistakes and I suggest some alternative solution. +http://www.artima.com/weblogs/viewpost.jsp?thread=246483 + +Mixins considered harmful/3 +by Michele Simionato +April 3, 2009 +My series against mixins continues. This time I consider using proxies instead of mixins, and I pose a design problem which will be solved in the last issue. +http://www.artima.com/weblogs/viewpost.jsp?thread=254367 +