diff options
author | michele.simionato <devnull@localhost> | 2009-10-01 06:12:44 +0000 |
---|---|---|
committer | michele.simionato <devnull@localhost> | 2009-10-01 06:12:44 +0000 |
commit | 78f315af3b0e39905169113fb9f2e1a5ca65e03f (patch) | |
tree | be12d56e015410ea6b54f20821ebd6810fce6dca /artima | |
parent | 381352a1885f617dd2006dbb1f4a39e9fcd360db (diff) | |
download | micheles-78f315af3b0e39905169113fb9f2e1a5ca65e03f.tar.gz |
Added a mechanism to generate a single PDF from my articles about super
Diffstat (limited to 'artima')
-rw-r--r-- | artima/python/Makefile | 12 | ||||
-rw-r--r-- | artima/python/super.rst | 18 | ||||
-rw-r--r-- | artima/python/super1.py | 4 | ||||
-rw-r--r-- | artima/python/super2.py | 4 | ||||
-rw-r--r-- | artima/python/super3.py | 2 |
5 files changed, 34 insertions, 6 deletions
diff --git a/artima/python/Makefile b/artima/python/Makefile index a46fd24..dfcfcba 100644 --- a/artima/python/Makefile +++ b/artima/python/Makefile @@ -1,4 +1,5 @@ POST = python ../post.py +RST = python ~/trunk/ROnline/RCommon/Python/ms/tools/rst.py MINIDOC = python ~/trunk/ROnline/RCommon/Python/ms/tools/minidoc.py default: @@ -13,6 +14,10 @@ super2: super2.py super3: super3.py $(MINIDOC) -d super3; $(POST) /tmp/super3.rst 237121 +super: super.rst + $(RST) -tp super.rst + scp super.pdf micheles@merlin.phyast.pitt.edu:public_html/python + generic: genericfunctions.py $(MINIDOC) -d genericfunctions; $(POST) /tmp/genericfunctions.rst 237764 @@ -25,6 +30,12 @@ pycon3: pycon3.txt records1: records1.py $(MINIDOC) -d records1; $(POST) /tmp/records1.rst 236637 +records2: records2.py + $(MINIDOC) -d records2; $(POST) /tmp/records2.rst 269269 + +records3: records3.py + $(MINIDOC) -d records3; $(POST) /tmp/records3.rst + decorator3: decorator3.txt $(POST) decorator3.txt 243843 @@ -37,7 +48,6 @@ mixins1: mixins1.py mixins2: mixins2.py $(MINIDOC) -d mixins2; $(POST) /tmp/mixins2.rst 246483 - mixins3: mixins3.py $(MINIDOC) -d mixins3; $(POST) /tmp/mixins3.rst 254367 diff --git a/artima/python/super.rst b/artima/python/super.rst new file mode 100644 index 0000000..d89424f --- /dev/null +++ b/artima/python/super.rst @@ -0,0 +1,18 @@ +Things to know about super +================================================== + +:author: Michele Simionato +:date: August 2008 + +This document is the sum of three blog post appeared on Artima +and converted into PDF form for readers' convenience: + +- http://www.artima.com/weblogs/viewpost.jsp?thread=236275 +- http://www.artima.com/weblogs/viewpost.jsp?thread=236278 +- http://www.artima.com/weblogs/viewpost.jsp?thread=237121 + +.. contents:: + +.. include:: /tmp/super1.rst +.. include:: /tmp/super2.rst +.. include:: /tmp/super3.rst diff --git a/artima/python/super1.py b/artima/python/super1.py index b9f2d03..c42cf6d 100644 --- a/artima/python/super1.py +++ b/artima/python/super1.py @@ -66,7 +66,7 @@ I have discovered with my experimentations, which is certainly not the whole truth ;) A fair warning is in order here: this document is aimed at expert -Pythonistas. It assumes you are familiar with `new-style classes`_ and +Pythonistas. It assumes you are familiar with `new style classes`_ and the `Method Resolution Order`_ (MRO); moreover a good understanding of descriptors_ would be extremely useful. Some parts also require good familiarity with metaclasses_. All in all, this paper is not for the @@ -312,7 +312,7 @@ function first: <unbound method D.__repr__> .. _Method Resolution Order: http://www.python.org/download/releases/2.3/mro/ -.. _new-style classes: http://www.python.org/download/releases/2.2.3/descrintro/ +.. _new style classes: http://www.python.org/download/releases/2.2.3/descrintro/ .. _descriptors: http://users.rcn.com/python/download/Descriptor.htm .. _metaclasses: http://www.ibm.com/developerworks/library/l-pymeta.html .. _comp.lang.python in May 2003: http://tinyurl.com/5ms8lk diff --git a/artima/python/super2.py b/artima/python/super2.py index ec56bd8..617e5cf 100644 --- a/artima/python/super2.py +++ b/artima/python/super2.py @@ -104,9 +104,9 @@ turned into ``super(C, d).a`` and retrieves ``B.a``. There is a single use case for the single argument syntax of ``super`` that I am aware of, but I think it gives more troubles than advantages. The use case is the implementation of *autosuper* made -by Guido on his essay about `new-style classes`_. +by Guido on his essay about `new style classes`_. -.. _new-style classes: http://www.python.org/download/releases/2.2.3/descrintro/#cooperation +.. _new style classes: http://www.python.org/download/releases/2.2.3/descrintro/#cooperation The idea there is to use the unbound super objects as private attributes. For instance, in our example, we could define the diff --git a/artima/python/super3.py b/artima/python/super3.py index 5fef848..45a3226 100644 --- a/artima/python/super3.py +++ b/artima/python/super3.py @@ -174,7 +174,7 @@ the application programmer cannot use ``super`` either, otherwise >>> c = C() C A -So, if use classes coming from a library in a multiple inheritance +So, if you use classes coming from a library in a multiple inheritance situation, you must know if the classes were intended to be cooperative (using ``super``) or not. Library author should always document their usage of ``super``. |