summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile15
-rw-r--r--documentation.pdf5717
-rw-r--r--documentation.py330
-rw-r--r--documentation.rst258
-rw-r--r--documentation3.pdf6721
-rw-r--r--documentation3.py1208
-rw-r--r--documentation3.rst1054
-rw-r--r--src/decorator.py20
-rw-r--r--test.py9
9 files changed, 3304 insertions, 12028 deletions
diff --git a/Makefile b/Makefile
index 9c60720..06f48c7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,15 @@
RST=python $(S)/ms/tools/rst.py
-rst: documentation.py documentation3.py
- PYTHONPATH=src:$(S) python $(S)/ms/tools/minidoc.py -d documentation.py
- python3 $(S)/minidoc3.py -d documentation3.py
- cp /tmp/documentation.rst /tmp/documentation3.rst .
+rst: documentation.py
+ PYTHONPATH=src:$(S) python3 $(S)/minidoc3.py -d documentation.py
+ cp /tmp/documentation.rst .
-html: /tmp/documentation.rst /tmp/documentation3.rst README.rst
+html: /tmp/documentation.rst README.rst
$(RST) /tmp/documentation.rst
- $(RST) /tmp/documentation3.rst
rst2html README.rst index.html
-pdf: /tmp/documentation.rst /tmp/documentation3.rst
+pdf: /tmp/documentation.rst
rst2pdf /tmp/documentation.rst -o documentation.pdf
- rst2pdf /tmp/documentation3.rst -o documentation3.pdf
-upload: documentation.pdf documentation3.pdf
+upload: documentation.pdf
python3 setup.py register sdist upload
diff --git a/documentation.pdf b/documentation.pdf
index 9955da4..4d24890 100644
--- a/documentation.pdf
+++ b/documentation.pdf
@@ -1,7 +1,7 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
1 0 obj
-<< /F1 2 0 R /F2 3 0 R /F3 4 0 R /F4 7 0 R /F5 44 0 R /F6 46 0 R >>
+<< /F1 2 0 R /F2 3 0 R /F3 4 0 R /F4 47 0 R /F5 49 0 R /F6 50 0 R >>
endobj
2 0 obj
<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
@@ -10,270 +10,305 @@ endobj
<< /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font >>
endobj
4 0 obj
-<< /BaseFont /Courier-Bold /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font >>
+<< /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font >>
endobj
5 0 obj
-<< /A << /S /URI /Type /Action /URI (mailto:michele.simionato@gmail.com) >> /Border [ 0 0 0 ] /Rect [ 153.7323 704.7736 289.4623 716.7736 ] /Subtype /Link /Type /Annot >>
+<< /A << /S /URI /Type /Action /URI (mailto:michele.simionato@gmail.com) >> /Border [ 0 0 0 ] /Rect [ 153.7323 704.0236 289.4623 716.0236 ] /Subtype /Link /Type /Annot >>
endobj
6 0 obj
-<< /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/decorator/3.4.1) >> /Border [ 0 0 0 ] /Rect [ 153.7323 659.7736 526.5827 671.7736 ] /Subtype /Link /Type /Annot >>
+<< /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/decorator/4.0.0) >> /Border [ 0 0 0 ] /Rect [ 153.7323 659.7736 338.2823 671.7736 ] /Subtype /Link /Type /Annot >>
endobj
7 0 obj
-<< /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 46 0 R /XYZ 62.69291 257.0236 0 ] /Rect [ 62.69291 560.0236 121.0229 572.0236 ] /Subtype /Link /Type /Annot >>
endobj
8 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 43 0 R /XYZ 62.69291 293.0236 0 ] /Rect [ 62.69291 560.7736 121.0229 572.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 46 0 R /XYZ 62.69291 257.0236 0 ] /Rect [ 527.0227 560.7736 532.5827 572.7736 ] /Subtype /Link /Type /Annot >>
endobj
9 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 43 0 R /XYZ 62.69291 293.0236 0 ] /Rect [ 527.0227 560.7736 532.5827 572.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 633.0236 0 ] /Rect [ 62.69291 542.0236 114.3629 554.0236 ] /Subtype /Link /Type /Annot >>
endobj
10 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 48 0 R /XYZ 62.69291 675.0236 0 ] /Rect [ 62.69291 542.7736 114.3629 554.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 633.0236 0 ] /Rect [ 527.0227 542.7736 532.5827 554.7736 ] /Subtype /Link /Type /Annot >>
endobj
11 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 48 0 R /XYZ 62.69291 675.0236 0 ] /Rect [ 527.0227 542.7736 532.5827 554.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 396.0236 0 ] /Rect [ 62.69291 524.0236 183.2629 536.0236 ] /Subtype /Link /Type /Annot >>
endobj
12 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 48 0 R /XYZ 62.69291 438.0236 0 ] /Rect [ 62.69291 524.7736 183.2629 536.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 396.0236 0 ] /Rect [ 527.0227 524.7736 532.5827 536.7736 ] /Subtype /Link /Type /Annot >>
endobj
13 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 48 0 R /XYZ 62.69291 438.0236 0 ] /Rect [ 527.0227 524.7736 532.5827 536.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 53 0 R /XYZ 62.69291 373.4236 0 ] /Rect [ 62.69291 506.0236 122.1429 518.0236 ] /Subtype /Link /Type /Annot >>
endobj
14 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 427.4236 0 ] /Rect [ 62.69291 506.7736 122.1429 518.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 53 0 R /XYZ 62.69291 373.4236 0 ] /Rect [ 527.0227 506.7736 532.5827 518.7736 ] /Subtype /Link /Type /Annot >>
endobj
15 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 427.4236 0 ] /Rect [ 527.0227 506.7736 532.5827 518.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 62.69291 488.0236 69.91291 500.0236 ] /Subtype /Link /Type /Annot >>
endobj
16 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 50 0 R /XYZ 62.69291 435.4236 0 ] /Rect [ 62.69291 488.7736 72.69291 500.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 72.69291 488.0236 102.6929 500.0236 ] /Subtype /Link /Type /Annot >>
endobj
17 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 50 0 R /XYZ 62.69291 435.4236 0 ] /Rect [ 72.69291 488.7736 108.6929 500.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 108.6929 488.0236 154.8129 500.0236 ] /Subtype /Link /Type /Annot >>
endobj
18 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 50 0 R /XYZ 62.69291 435.4236 0 ] /Rect [ 108.6929 488.7736 154.8129 500.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 527.0227 488.7736 532.5827 500.7736 ] /Subtype /Link /Type /Annot >>
endobj
19 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 50 0 R /XYZ 62.69291 435.4236 0 ] /Rect [ 527.0227 488.7736 532.5827 500.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 62.69291 470.0236 164.3629 482.0236 ] /Subtype /Link /Type /Annot >>
endobj
20 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 397.4236 0 ] /Rect [ 62.69291 470.7736 122.6929 482.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 527.0227 470.7736 532.5827 482.7736 ] /Subtype /Link /Type /Annot >>
endobj
21 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 397.4236 0 ] /Rect [ 122.6929 470.7736 188.2729 482.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 57 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 62.69291 452.0236 116.6929 464.0236 ] /Subtype /Link /Type /Annot >>
endobj
22 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 397.4236 0 ] /Rect [ 527.0227 470.7736 532.5827 482.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 57 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 122.6929 452.0236 188.2729 464.0236 ] /Subtype /Link /Type /Annot >>
endobj
23 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 647.8236 0 ] /Rect [ 62.69291 452.7736 110.6929 464.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 57 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 527.0227 452.7736 532.5827 464.7736 ] /Subtype /Link /Type /Annot >>
endobj
24 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 647.8236 0 ] /Rect [ 527.0227 452.7736 532.5827 464.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 57 0 R /XYZ 62.69291 302.4236 0 ] /Rect [ 62.69291 434.0236 110.6929 446.0236 ] /Subtype /Link /Type /Annot >>
endobj
25 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 53 0 R /XYZ 62.69291 765.0236 0 ] /Rect [ 62.69291 434.7736 92.69291 446.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 57 0 R /XYZ 62.69291 302.4236 0 ] /Rect [ 527.0227 434.7736 532.5827 446.7736 ] /Subtype /Link /Type /Annot >>
endobj
26 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 53 0 R /XYZ 62.69291 765.0236 0 ] /Rect [ 527.0227 434.7736 532.5827 446.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 58 0 R /XYZ 62.69291 422.6236 0 ] /Rect [ 62.69291 416.0236 92.69291 428.0236 ] /Subtype /Link /Type /Annot >>
endobj
27 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 255.4236 0 ] /Rect [ 62.69291 416.7736 139.9329 428.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 58 0 R /XYZ 62.69291 422.6236 0 ] /Rect [ 527.0227 416.7736 532.5827 428.7736 ] /Subtype /Link /Type /Annot >>
endobj
28 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 255.4236 0 ] /Rect [ 527.0227 416.7736 532.5827 428.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 60 0 R /XYZ 62.69291 563.8236 0 ] /Rect [ 62.69291 398.0236 139.9329 410.0236 ] /Subtype /Link /Type /Annot >>
endobj
29 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 324.6236 0 ] /Rect [ 62.69291 398.7736 83.25291 410.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 60 0 R /XYZ 62.69291 563.8236 0 ] /Rect [ 527.0227 398.7736 532.5827 410.7736 ] /Subtype /Link /Type /Annot >>
endobj
30 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 324.6236 0 ] /Rect [ 83.25291 398.7736 167.2529 410.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 693.0236 0 ] /Rect [ 62.69291 380.0236 80.47291 392.0236 ] /Subtype /Link /Type /Annot >>
endobj
31 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 324.6236 0 ] /Rect [ 167.2529 398.7736 192.2729 410.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 693.0236 0 ] /Rect [ 83.25291 380.0236 161.2529 392.0236 ] /Subtype /Link /Type /Annot >>
endobj
32 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 324.6236 0 ] /Rect [ 527.0227 398.7736 532.5827 410.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 693.0236 0 ] /Rect [ 167.2529 380.0236 192.2729 392.0236 ] /Subtype /Link /Type /Annot >>
endobj
33 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 333.8236 0 ] /Rect [ 62.69291 380.7736 177.1629 392.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 693.0236 0 ] /Rect [ 521.4627 380.7736 532.5827 392.7736 ] /Subtype /Link /Type /Annot >>
endobj
34 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 333.8236 0 ] /Rect [ 521.4627 380.7736 532.5827 392.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 63 0 R /XYZ 62.69291 717.0236 0 ] /Rect [ 62.69291 362.0236 177.1629 374.0236 ] /Subtype /Link /Type /Annot >>
endobj
35 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 542.6236 0 ] /Rect [ 62.69291 362.7736 228.2829 374.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 63 0 R /XYZ 62.69291 717.0236 0 ] /Rect [ 521.4627 362.7736 532.5827 374.7736 ] /Subtype /Link /Type /Annot >>
endobj
36 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 542.6236 0 ] /Rect [ 521.4627 362.7736 532.5827 374.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 63 0 R /XYZ 62.69291 246.4236 0 ] /Rect [ 62.69291 344.0236 228.2829 356.0236 ] /Subtype /Link /Type /Annot >>
endobj
37 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 60 0 R /XYZ 62.69291 131.0236 0 ] /Rect [ 62.69291 344.7736 174.3929 356.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 63 0 R /XYZ 62.69291 246.4236 0 ] /Rect [ 521.4627 344.7736 532.5827 356.7736 ] /Subtype /Link /Type /Annot >>
endobj
38 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 60 0 R /XYZ 62.69291 131.0236 0 ] /Rect [ 521.4627 344.7736 532.5827 356.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 66 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 62.69291 326.0236 174.3929 338.0236 ] /Subtype /Link /Type /Annot >>
endobj
39 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 65 0 R /XYZ 62.69291 679.8236 0 ] /Rect [ 62.69291 326.7736 155.4829 338.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 66 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 521.4627 326.7736 532.5827 338.7736 ] /Subtype /Link /Type /Annot >>
endobj
40 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 65 0 R /XYZ 62.69291 679.8236 0 ] /Rect [ 521.4627 326.7736 532.5827 338.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 667.8236 0 ] /Rect [ 62.69291 308.0236 155.4829 320.0236 ] /Subtype /Link /Type /Annot >>
endobj
41 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 65 0 R /XYZ 62.69291 526.8236 0 ] /Rect [ 62.69291 308.7736 106.5829 320.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 667.8236 0 ] /Rect [ 521.4627 308.7736 532.5827 320.7736 ] /Subtype /Link /Type /Annot >>
endobj
42 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 65 0 R /XYZ 62.69291 526.8236 0 ] /Rect [ 521.4627 308.7736 532.5827 320.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 592.8236 0 ] /Rect [ 62.69291 290.0236 137.7129 302.0236 ] /Subtype /Link /Type /Annot >>
endobj
43 0 obj
-<< /Annots [ 5 0 R 6 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R 15 0 R
- 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R
- 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R 35 0 R
- 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R ] /Contents 85 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 592.8236 0 ] /Rect [ 521.4627 290.7736 532.5827 302.7736 ] /Subtype /Link /Type /Annot >>
endobj
44 0 obj
-<< /BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F5 /Subtype /Type1 /Type /Font >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 223.8236 0 ] /Rect [ 62.69291 272.0236 106.5829 284.0236 ] /Subtype /Link /Type /Annot >>
endobj
45 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/moin/PythonDecoratorLibrary) >> /Border [ 0 0 0 ] /Rect [ 219.6428 363.7736 449.1728 375.7736 ] /Subtype /Link /Type /Annot >>
+<< /Border [ 0 0 0 ] /Contents () /Dest [ 73 0 R /XYZ 62.69291 223.8236 0 ] /Rect [ 521.4627 272.7736 532.5827 284.7736 ] /Subtype /Link /Type /Annot >>
endobj
46 0 obj
-<< /BaseFont /Courier-Oblique /Encoding /WinAnsiEncoding /Name /F6 /Subtype /Type1 /Type /Font >>
+<< /Annots [ 5 0 R 6 0 R 7 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R
+ 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R
+ 25 0 R 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R
+ 35 0 R 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R 43 0 R 44 0 R
+ 45 0 R ] /Contents 96 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
47 0 obj
-<< /A << /S /URI /Type /Action /URI (https://docs.python.org/2/library/functools.html#functools.update_wrapper) >> /Border [ 0 0 0 ] /Rect [ 151.0486 118.5736 270.69 130.5736 ] /Subtype /Link /Type /Annot >>
+<< /BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font >>
endobj
48 0 obj
-<< /Annots [ 45 0 R 47 0 R ] /Contents 86 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
+<< /A << /S /URI /Type /Action /URI (http://www.python.org/moin/PythonDecoratorLibrary) >> /Border [ 0 0 0 ] /Rect [ 219.6428 321.0236 449.1728 333.0236 ] /Subtype /Link /Type /Annot >>
endobj
49 0 obj
-<< /Contents 87 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /BaseFont /Courier-Bold /Encoding /WinAnsiEncoding /Name /F5 /Subtype /Type1 /Type /Font >>
endobj
50 0 obj
-<< /Contents 88 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /BaseFont /Courier-Oblique /Encoding /WinAnsiEncoding /Name /F6 /Subtype /Type1 /Type /Font >>
endobj
51 0 obj
-<< /Contents 89 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /Annots [ 48 0 R ] /Contents 97 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
52 0 obj
-<< /Contents 90 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /A << /S /URI /Type /Action /URI (https://docs.python.org/3/library/functools.html#functools.update_wrapper) >> /Border [ 0 0 0 ] /Rect [ 151.0486 753.0236 267.91 765.0236 ] /Subtype /Link /Type /Annot >>
endobj
53 0 obj
-<< /Contents 91 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /Annots [ 52 0 R ] /Contents 98 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
54 0 obj
-<< /Contents 92 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+<< /Contents 99 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
/Type /Page >>
endobj
55 0 obj
-<< /Contents 93 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-3107/) >> /Border [ 0 0 0 ] /Rect [ 231.6368 462.4236 323.0741 474.4236 ] /Subtype /Link /Type /Annot >>
endobj
56 0 obj
-<< /Contents 94 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
+<< /Annots [ 55 0 R ] /Contents 100 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
57 0 obj
-<< /A << /S /URI /Type /Action /URI (http://bugs.python.org/issue1764286) >> /Border [ 0 0 0 ] /Rect [ 137.6966 708.5736 180.8679 720.5736 ] /Subtype /Link /Type /Annot >>
+<< /Contents 101 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+ /Type /Page >>
endobj
58 0 obj
-<< /A << /S /URI /Type /Action /URI (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) >> /Border [ 0 0 0 ] /Rect [ 62.69291 223.1736 363.4029 235.1736 ] /Subtype /Link /Type /Annot >>
+<< /Contents 102 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+ /Type /Page >>
endobj
59 0 obj
-<< /Annots [ 57 0 R 58 0 R ] /Contents 95 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
+<< /Contents 103 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+ /Type /Page >>
endobj
60 0 obj
-<< /Contents 96 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+<< /Contents 104 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
/Type /Page >>
endobj
61 0 obj
-<< /Contents 97 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+<< /Contents 105 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
/Type /Page >>
endobj
62 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-0362) >> /Border [ 0 0 0 ] /Rect [ 301.1597 729.7736 317.8397 741.7736 ] /Subtype /Link /Type /Annot >>
+<< /A << /S /URI /Type /Action /URI (http://bugs.python.org/issue1764286) >> /Border [ 0 0 0 ] /Rect [ 137.6966 411.6236 178.0879 423.6236 ] /Subtype /Link /Type /Annot >>
endobj
63 0 obj
-<< /Annots [ 62 0 R ] /Contents 98 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+<< /Annots [ 62 0 R ] /Contents 106 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
/Trans << >> /Type /Page >>
endobj
64 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-3107/) >> /Border [ 0 0 0 ] /Rect [ 281.1568 641.5736 372.4888 653.5736 ] /Subtype /Link /Type /Annot >>
+<< /A << /S /URI /Type /Action /URI (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) >> /Border [ 0 0 0 ] /Rect [ 62.69291 599.8236 363.4029 611.8236 ] /Subtype /Link /Type /Annot >>
endobj
65 0 obj
-<< /Annots [ 64 0 R ] /Contents 99 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 84 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+<< /Annots [ 64 0 R ] /Contents 107 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
/Trans << >> /Type /Page >>
endobj
66 0 obj
-<< /Outlines 68 0 R /PageLabels 100 0 R /PageMode /UseNone /Pages 84 0 R /Type /Catalog >>
+<< /Contents 108 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+ /Type /Page >>
endobj
67 0 obj
-<< /Author (Michele Simionato) /CreationDate (D:20150316162015-01'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\))
- /Title (The decorator module) >>
+<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-0362) >> /Border [ 0 0 0 ] /Rect [ 301.1597 412.6236 317.8397 424.6236 ] /Subtype /Link /Type /Annot >>
endobj
68 0 obj
-<< /Count 15 /First 69 0 R /Last 83 0 R /Type /Outlines >>
+<< /Annots [ 67 0 R ] /Contents 109 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
69 0 obj
-<< /Dest [ 43 0 R /XYZ 62.69291 293.0236 0 ] /Next 70 0 R /Parent 68 0 R /Title (Introduction) >>
+<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-3107/) >> /Border [ 0 0 0 ] /Rect [ 384.6306 523.8236 474.9013 535.8236 ] /Subtype /Link /Type /Annot >>
endobj
70 0 obj
-<< /Dest [ 48 0 R /XYZ 62.69291 675.0236 0 ] /Next 71 0 R /Parent 68 0 R /Prev 69 0 R /Title (Definitions) >>
+<< /A << /S /URI /Type /Action /URI (http://docutils.sourceforge.net/) >> /Border [ 0 0 0 ] /Rect [ 476.7077 499.8236 513.1227 511.8236 ] /Subtype /Link /Type /Annot >>
endobj
71 0 obj
-<< /Dest [ 48 0 R /XYZ 62.69291 438.0236 0 ] /Next 72 0 R /Parent 68 0 R /Prev 70 0 R /Title (Statement of the problem) >>
+<< /A << /S /URI /Type /Action /URI (http://pygments.org/) >> /Border [ 0 0 0 ] /Rect [ 62.69291 487.8236 106.0429 499.8236 ] /Subtype /Link /Type /Annot >>
endobj
72 0 obj
-<< /Dest [ 49 0 R /XYZ 62.69291 427.4236 0 ] /Next 73 0 R /Parent 68 0 R /Prev 71 0 R /Title (The solution) >>
+<< /A << /S /URI /Type /Action /URI (http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories) >> /Border [ 0 0 0 ] /Rect [ 364.2921 349.8236 531.64 361.8236 ] /Subtype /Link /Type /Annot >>
endobj
73 0 obj
-<< /Dest [ 50 0 R /XYZ 62.69291 435.4236 0 ] /Next 74 0 R /Parent 68 0 R /Prev 72 0 R /Title (A trace decorator) >>
+<< /Annots [ 69 0 R 70 0 R 71 0 R 72 0 R ] /Contents 110 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
+ /Trans << >> /Type /Page >>
endobj
74 0 obj
-<< /Dest [ 51 0 R /XYZ 62.69291 397.4236 0 ] /Next 75 0 R /Parent 68 0 R /Prev 73 0 R /Title (decorator is a decorator) >>
+<< /Contents 111 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 95 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
+ /Type /Page >>
endobj
75 0 obj
-<< /Dest [ 52 0 R /XYZ 62.69291 647.8236 0 ] /Next 76 0 R /Parent 68 0 R /Prev 74 0 R /Title (blocking) >>
+<< /Outlines 77 0 R /PageLabels 112 0 R /PageMode /UseNone /Pages 95 0 R /Type /Catalog >>
endobj
76 0 obj
-<< /Dest [ 53 0 R /XYZ 62.69291 765.0236 0 ] /Next 77 0 R /Parent 68 0 R /Prev 75 0 R /Title (async) >>
+<< /Author (Michele Simionato) /CreationDate (D:20150719073244-01'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\))
+ /Title (The decorator module) >>
endobj
77 0 obj
-<< /Dest [ 54 0 R /XYZ 62.69291 255.4236 0 ] /Next 78 0 R /Parent 68 0 R /Prev 76 0 R /Title (contextmanager) >>
+<< /Count 17 /First 78 0 R /Last 94 0 R /Type /Outlines >>
endobj
78 0 obj
-<< /Dest [ 55 0 R /XYZ 62.69291 324.6236 0 ] /Next 79 0 R /Parent 68 0 R /Prev 77 0 R /Title (The FunctionMaker class) >>
+<< /Dest [ 46 0 R /XYZ 62.69291 257.0236 0 ] /Next 79 0 R /Parent 77 0 R /Title (Introduction) >>
endobj
79 0 obj
-<< /Dest [ 56 0 R /XYZ 62.69291 333.8236 0 ] /Next 80 0 R /Parent 68 0 R /Prev 78 0 R /Title (Getting the source code) >>
+<< /Dest [ 51 0 R /XYZ 62.69291 633.0236 0 ] /Next 80 0 R /Parent 77 0 R /Prev 78 0 R /Title (Definitions) >>
endobj
80 0 obj
-<< /Dest [ 59 0 R /XYZ 62.69291 542.6236 0 ] /Next 81 0 R /Parent 68 0 R /Prev 79 0 R /Title (Dealing with third party decorators) >>
+<< /Dest [ 51 0 R /XYZ 62.69291 396.0236 0 ] /Next 81 0 R /Parent 77 0 R /Prev 79 0 R /Title (Statement of the problem) >>
endobj
81 0 obj
-<< /Dest [ 60 0 R /XYZ 62.69291 131.0236 0 ] /Next 82 0 R /Parent 68 0 R /Prev 80 0 R /Title (Caveats and limitations) >>
+<< /Dest [ 53 0 R /XYZ 62.69291 373.4236 0 ] /Next 82 0 R /Parent 77 0 R /Prev 80 0 R /Title (The solution) >>
endobj
82 0 obj
-<< /Dest [ 65 0 R /XYZ 62.69291 679.8236 0 ] /Next 83 0 R /Parent 68 0 R /Prev 81 0 R /Title (Compatibility notes) >>
+<< /Dest [ 54 0 R /XYZ 62.69291 370.2236 0 ] /Next 83 0 R /Parent 77 0 R /Prev 81 0 R /Title (A trace decorator) >>
endobj
83 0 obj
-<< /Dest [ 65 0 R /XYZ 62.69291 526.8236 0 ] /Parent 68 0 R /Prev 82 0 R /Title (LICENCE) >>
+<< /Dest [ 56 0 R /XYZ 62.69291 501.4236 0 ] /Next 84 0 R /Parent 77 0 R /Prev 82 0 R /Title (Function annotations) >>
endobj
84 0 obj
-<< /Count 15 /Kids [ 43 0 R 48 0 R 49 0 R 50 0 R 51 0 R 52 0 R 53 0 R 54 0 R 55 0 R 56 0 R
- 59 0 R 60 0 R 61 0 R 63 0 R 65 0 R ] /Type /Pages >>
+<< /Dest [ 57 0 R /XYZ 62.69291 729.0236 0 ] /Next 85 0 R /Parent 77 0 R /Prev 83 0 R /Title (decorator is a decorator) >>
endobj
85 0 obj
-<< /Length 9109 >>
+<< /Dest [ 57 0 R /XYZ 62.69291 302.4236 0 ] /Next 86 0 R /Parent 77 0 R /Prev 84 0 R /Title (blocking) >>
+endobj
+86 0 obj
+<< /Dest [ 58 0 R /XYZ 62.69291 422.6236 0 ] /Next 87 0 R /Parent 77 0 R /Prev 85 0 R /Title (async) >>
+endobj
+87 0 obj
+<< /Dest [ 60 0 R /XYZ 62.69291 563.8236 0 ] /Next 88 0 R /Parent 77 0 R /Prev 86 0 R /Title (contextmanager) >>
+endobj
+88 0 obj
+<< /Dest [ 61 0 R /XYZ 62.69291 693.0236 0 ] /Next 89 0 R /Parent 77 0 R /Prev 87 0 R /Title (The FunctionMaker class) >>
+endobj
+89 0 obj
+<< /Dest [ 63 0 R /XYZ 62.69291 717.0236 0 ] /Next 90 0 R /Parent 77 0 R /Prev 88 0 R /Title (Getting the source code) >>
+endobj
+90 0 obj
+<< /Dest [ 63 0 R /XYZ 62.69291 246.4236 0 ] /Next 91 0 R /Parent 77 0 R /Prev 89 0 R /Title (Dealing with third party decorators) >>
+endobj
+91 0 obj
+<< /Dest [ 66 0 R /XYZ 62.69291 501.4236 0 ] /Next 92 0 R /Parent 77 0 R /Prev 90 0 R /Title (Caveats and limitations) >>
+endobj
+92 0 obj
+<< /Dest [ 73 0 R /XYZ 62.69291 667.8236 0 ] /Next 93 0 R /Parent 77 0 R /Prev 91 0 R /Title (Compatibility notes) >>
+endobj
+93 0 obj
+<< /Dest [ 73 0 R /XYZ 62.69291 592.8236 0 ] /Next 94 0 R /Parent 77 0 R /Prev 92 0 R /Title (Historical notes) >>
+endobj
+94 0 obj
+<< /Dest [ 73 0 R /XYZ 62.69291 223.8236 0 ] /Parent 77 0 R /Prev 93 0 R /Title (LICENCE) >>
+endobj
+95 0 obj
+<< /Count 16 /Kids [ 46 0 R 51 0 R 53 0 R 54 0 R 56 0 R 57 0 R 58 0 R 59 0 R 60 0 R 61 0 R
+ 63 0 R 65 0 R 66 0 R 68 0 R 73 0 R 74 0 R ] /Type /Pages >>
+endobj
+96 0 obj
+<< /Length 9230 >>
stream
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
@@ -338,7 +373,7 @@ q
1 0 0 1 91.03937 3 cm
q
0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (3.4.1 \(2015-03-16\)) Tj T* ET
+BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (4.0.0 \(2015-07-19\)) Tj T* ET
Q
Q
q
@@ -359,7 +394,7 @@ q
1 0 0 1 91.03937 3 cm
q
0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Python 2.4+) Tj T* ET
+BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Python 2.6+) Tj T* ET
Q
Q
q
@@ -381,7 +416,7 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (http://pypi.python.org/pypi/decorator/3.4.1) Tj T* ET
+BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (http://pypi.python.org/pypi/decorator/4.0.0) Tj T* ET
Q
Q
q
@@ -401,7 +436,7 @@ Q
q
1 0 0 1 91.03937 3 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F4 10 Tf 0 0 0 rg (easy_install) Tj ( ) Tj (decorator) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (pip) Tj ( ) Tj (install) Tj ( ) Tj (decorator) Tj T* ET
Q
Q
q
@@ -435,17 +470,17 @@ BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Contents) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 305.0236 cm
+1 0 0 1 62.69291 269.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
-1 0 0 1 0 255 cm
+1 0 0 1 0 291 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Introduction) Tj T* ET
Q
Q
q
-1 0 0 1 397.8898 255 cm
+1 0 0 1 397.8898 291 cm
q
0 0 .501961 rg
0 0 .501961 RG
@@ -453,13 +488,13 @@ BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
Q
Q
q
-1 0 0 1 0 237 cm
+1 0 0 1 0 273 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Definitions) Tj T* ET
Q
Q
q
-1 0 0 1 397.8898 237 cm
+1 0 0 1 397.8898 273 cm
q
0 0 .501961 rg
0 0 .501961 RG
@@ -467,13 +502,13 @@ BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
Q
Q
q
-1 0 0 1 0 219 cm
+1 0 0 1 0 255 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Statement of the problem) Tj T* ET
Q
Q
q
-1 0 0 1 397.8898 219 cm
+1 0 0 1 397.8898 255 cm
q
0 0 .501961 rg
0 0 .501961 RG
@@ -481,13 +516,13 @@ BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
Q
Q
q
-1 0 0 1 0 201 cm
+1 0 0 1 0 237 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (The solution) Tj T* ET
Q
Q
q
-1 0 0 1 397.8898 201 cm
+1 0 0 1 397.8898 237 cm
q
0 0 .501961 rg
0 0 .501961 RG
@@ -495,13 +530,13 @@ BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
Q
Q
q
-1 0 0 1 0 183 cm
+1 0 0 1 0 219 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (A ) Tj /F3 10 Tf 0 0 0 rg (trace ) Tj /F2 10 Tf 0 0 .501961 rg (decorator) Tj T* ET
Q
Q
q
-1 0 0 1 397.8898 183 cm
+1 0 0 1 397.8898 219 cm
q
0 0 .501961 rg
0 0 .501961 RG
@@ -509,23 +544,51 @@ BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (4) Tj T* -66.44 0 Td ET
Q
Q
q
-1 0 0 1 0 165 cm
+1 0 0 1 0 201 cm
+q
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Function annotations) Tj T* ET
+Q
+Q
+q
+1 0 0 1 397.8898 201 cm
+q
+0 0 .501961 rg
+0 0 .501961 RG
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (5) Tj T* -66.44 0 Td ET
+Q
+Q
+q
+1 0 0 1 0 183 cm
q
BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (decorator ) Tj /F2 10 Tf 0 0 .501961 rg (is a decorator) Tj T* ET
Q
Q
q
+1 0 0 1 397.8898 183 cm
+q
+0 0 .501961 rg
+0 0 .501961 RG
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (6) Tj T* -66.44 0 Td ET
+Q
+Q
+q
+1 0 0 1 0 165 cm
+q
+BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (blocking) Tj T* ET
+Q
+Q
+q
1 0 0 1 397.8898 165 cm
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (5) Tj T* -66.44 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (6) Tj T* -66.44 0 Td ET
Q
Q
q
1 0 0 1 0 147 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (blocking) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (async) Tj T* ET
Q
Q
q
@@ -533,13 +596,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (6) Tj T* -66.44 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (7) Tj T* -66.44 0 Td ET
Q
Q
q
1 0 0 1 0 129 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (async) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (contextmanager) Tj T* ET
Q
Q
q
@@ -547,13 +610,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (7) Tj T* -66.44 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (9) Tj T* -66.44 0 Td ET
Q
Q
q
1 0 0 1 0 111 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (contextmanager) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (The ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F2 10 Tf 0 0 .501961 rg (class) Tj T* ET
Q
Q
q
@@ -561,13 +624,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (8) Tj T* -66.44 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (10) Tj T* -60.88 0 Td ET
Q
Q
q
1 0 0 1 0 93 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (The ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F2 10 Tf 0 0 .501961 rg (class) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Getting the source code) Tj T* ET
Q
Q
q
@@ -575,13 +638,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (9) Tj T* -66.44 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (11) Tj T* -60.88 0 Td ET
Q
Q
q
1 0 0 1 0 75 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Getting the source code) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Dealing with third party decorators) Tj T* ET
Q
Q
q
@@ -589,13 +652,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (10) Tj T* -60.88 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (11) Tj T* -60.88 0 Td ET
Q
Q
q
1 0 0 1 0 57 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Dealing with third party decorators) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Caveats and limitations) Tj T* ET
Q
Q
q
@@ -603,13 +666,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (11) Tj T* -60.88 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (13) Tj T* -60.88 0 Td ET
Q
Q
q
1 0 0 1 0 39 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Caveats and limitations) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Compatibility notes) Tj T* ET
Q
Q
q
@@ -617,13 +680,13 @@ q
q
0 0 .501961 rg
0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (12) Tj T* -60.88 0 Td ET
+BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (15) Tj T* -60.88 0 Td ET
Q
Q
q
1 0 0 1 0 21 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Compatibility notes) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Historical notes) Tj T* ET
Q
Q
q
@@ -652,26 +715,26 @@ q
Q
Q
q
-1 0 0 1 62.69291 272.0236 cm
+1 0 0 1 62.69291 236.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Introduction) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 206.0236 cm
+1 0 0 1 62.69291 170.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 50 Tm /F1 10 Tf 12 TL 3.995366 Tw (Python decorators are an interesting example of why syntactic sugar matters. In principle, their) Tj T* 0 Tw .151235 Tw (introduction in Python 2.4 changed nothing, since they do not provide any new functionality which was not) Tj T* 0 Tw 2.238555 Tw (already present in the language. In practice, their introduction has significantly changed the way we) Tj T* 0 Tw .098409 Tw (structure our programs in Python. I believe the change is for the best, and that decorators are a great idea) Tj T* 0 Tw (since:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 200.0236 cm
+1 0 0 1 62.69291 164.0236 cm
Q
q
-1 0 0 1 62.69291 200.0236 cm
+1 0 0 1 62.69291 164.0236 cm
Q
q
-1 0 0 1 62.69291 188.0236 cm
+1 0 0 1 62.69291 152.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -692,10 +755,10 @@ q
Q
Q
q
-1 0 0 1 62.69291 182.0236 cm
+1 0 0 1 62.69291 146.0236 cm
Q
q
-1 0 0 1 62.69291 170.0236 cm
+1 0 0 1 62.69291 134.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -716,10 +779,10 @@ q
Q
Q
q
-1 0 0 1 62.69291 164.0236 cm
+1 0 0 1 62.69291 128.0236 cm
Q
q
-1 0 0 1 62.69291 152.0236 cm
+1 0 0 1 62.69291 116.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -740,10 +803,10 @@ q
Q
Q
q
-1 0 0 1 62.69291 146.0236 cm
+1 0 0 1 62.69291 110.0236 cm
Q
q
-1 0 0 1 62.69291 134.0236 cm
+1 0 0 1 62.69291 98.02362 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -764,55 +827,55 @@ q
Q
Q
q
-1 0 0 1 62.69291 134.0236 cm
+1 0 0 1 62.69291 98.02362 cm
Q
+
+endstream
+endobj
+97 0 obj
+<< /Length 11992 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 92.02362 cm
+1 0 0 1 62.69291 729.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL .848876 Tw (Still, as of now, writing custom decorators correctly requires some experience and it is not as easy as it) Tj T* 0 Tw 1.049269 Tw (could be. For instance, typical implementations of decorators involve nested functions, and we all know) Tj T* 0 Tw (that flat is better than nested.) Tj T* ET
Q
Q
-
-endstream
-endobj
-86 0 obj
-<< /Length 12549 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 717.0236 cm
+1 0 0 1 62.69291 675.0236 cm
q
-BT 1 0 0 1 0 38 Tm 1.093735 Tw 12 TL /F1 10 Tf 0 0 0 rg (The aim of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module it to simplify the usage of decorators for the average programmer,) Tj T* 0 Tw 2.456136 Tw (and to popularize decorators by showing various non-trivial examples. Of course, as all techniques,) Tj T* 0 Tw 2.234987 Tw (decorators can be abused \(I have seen that\) and you should not try to solve every problem with a) Tj T* 0 Tw (decorator, just because you can.) Tj T* ET
+BT 1 0 0 1 0 38 Tm 1.093735 Tw 12 TL /F1 10 Tf 0 0 0 rg (The aim of the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module it to simplify the usage of decorators for the average programmer,) Tj T* 0 Tw 2.456136 Tw (and to popularize decorators by showing various non-trivial examples. Of course, as all techniques,) Tj T* 0 Tw 2.234987 Tw (decorators can be abused \(I have seen that\) and you should not try to solve every problem with a) Tj T* 0 Tw (decorator, just because you can.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 687.0236 cm
+1 0 0 1 62.69291 645.0236 cm
q
-BT 1 0 0 1 0 14 Tm .13561 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may find the source code for all the examples discussed here in the ) Tj /F4 10 Tf 0 0 0 rg (documentation.py ) Tj /F1 10 Tf 0 0 0 rg (file, which) Tj T* 0 Tw (contains this documentation in the form of doctests.) Tj T* ET
+BT 1 0 0 1 0 14 Tm .13561 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may find the source code for all the examples discussed here in the ) Tj /F3 10 Tf 0 0 0 rg (documentation.py ) Tj /F1 10 Tf 0 0 0 rg (file, which) Tj T* 0 Tw (contains this documentation in the form of doctests.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 654.0236 cm
+1 0 0 1 62.69291 612.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Definitions) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 612.0236 cm
+1 0 0 1 62.69291 570.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 2.37561 Tw (Technically speaking, any Python object which can be called with one argument can be used as a) Tj T* 0 Tw .472339 Tw (decorator. However, this definition is somewhat too large to be really useful. It is more convenient to split) Tj T* 0 Tw (the generic class of decorators in two subclasses:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 606.0236 cm
+1 0 0 1 62.69291 564.0236 cm
Q
q
-1 0 0 1 62.69291 606.0236 cm
+1 0 0 1 62.69291 564.0236 cm
Q
q
-1 0 0 1 62.69291 582.0236 cm
+1 0 0 1 62.69291 540.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -825,17 +888,17 @@ Q
q
1 0 0 1 23 -3 cm
q
-BT 1 0 0 1 0 14 Tm 2.68748 Tw 12 TL /F5 10 Tf 0 0 0 rg (signature-preserving ) Tj /F1 10 Tf (decorators, i.e. callable objects taking a function as input and returning a) Tj T* 0 Tw (function ) Tj /F5 10 Tf (with the same signature ) Tj /F1 10 Tf (as output;) Tj T* ET
+BT 1 0 0 1 0 14 Tm 2.68748 Tw 12 TL /F4 10 Tf 0 0 0 rg (signature-preserving ) Tj /F1 10 Tf (decorators, i.e. callable objects taking a function as input and returning a) Tj T* 0 Tw (function ) Tj /F4 10 Tf (with the same signature ) Tj /F1 10 Tf (as output;) Tj T* ET
Q
Q
q
Q
Q
q
-1 0 0 1 62.69291 576.0236 cm
+1 0 0 1 62.69291 534.0236 cm
Q
q
-1 0 0 1 62.69291 552.0236 cm
+1 0 0 1 62.69291 510.0236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
q
@@ -848,49 +911,49 @@ Q
q
1 0 0 1 23 -3 cm
q
-BT 1 0 0 1 0 14 Tm 1.43498 Tw 12 TL /F5 10 Tf 0 0 0 rg (signature-changing ) Tj /F1 10 Tf (decorators, i.e. decorators that change the signature of their input function, or) Tj T* 0 Tw (decorators returning non-callable objects.) Tj T* ET
+BT 1 0 0 1 0 14 Tm 1.43498 Tw 12 TL /F4 10 Tf 0 0 0 rg (signature-changing ) Tj /F1 10 Tf (decorators, i.e. decorators that change the signature of their input function, or) Tj T* 0 Tw (decorators returning non-callable objects.) Tj T* ET
Q
Q
q
Q
Q
q
-1 0 0 1 62.69291 552.0236 cm
+1 0 0 1 62.69291 510.0236 cm
Q
q
-1 0 0 1 62.69291 510.0236 cm
+1 0 0 1 62.69291 468.0236 cm
q
-BT 1 0 0 1 0 26 Tm 2.832706 Tw 12 TL /F1 10 Tf 0 0 0 rg (Signature-changing decorators have their use: for instance the builtin classes ) Tj /F4 10 Tf 0 0 0 rg (staticmethod ) Tj /F1 10 Tf 0 0 0 rg (and) Tj T* 0 Tw 1.506651 Tw /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (are in this group, since they take functions and return descriptor objects which are not) Tj T* 0 Tw (functions, nor callables.) Tj T* ET
+BT 1 0 0 1 0 26 Tm 2.832706 Tw 12 TL /F1 10 Tf 0 0 0 rg (Signature-changing decorators have their use: for instance the builtin classes ) Tj /F3 10 Tf 0 0 0 rg (staticmethod ) Tj /F1 10 Tf 0 0 0 rg (and) Tj T* 0 Tw 1.506651 Tw /F3 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (are in this group, since they take functions and return descriptor objects which are not) Tj T* 0 Tw (functions, nor callables.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 480.0236 cm
+1 0 0 1 62.69291 438.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.735814 Tw (However, signature-preserving decorators are more common and easier to reason about; in particular) Tj T* 0 Tw (signature-preserving decorators can be composed together whereas other decorators in general cannot.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 450.0236 cm
+1 0 0 1 62.69291 408.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .494983 Tw (Writing signature-preserving decorators from scratch is not that obvious, especially if one wants to define) Tj T* 0 Tw (proper decorators that can accept functions with any signature. A simple example will clarify the issue.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 417.0236 cm
+1 0 0 1 62.69291 375.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Statement of the problem) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 339.0236 cm
+1 0 0 1 62.69291 297.0236 cm
q
-BT 1 0 0 1 0 62 Tm .351235 Tw 12 TL /F1 10 Tf 0 0 0 rg (A very common use case for decorators is the memoization of functions. A ) Tj /F4 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (decorator works by) Tj T* 0 Tw .871988 Tw (caching the result of the function call in a dictionary, so that the next time the function is called with the) Tj T* 0 Tw 2.350651 Tw (same input parameters the result is retrieved from the cache and not recomputed. There are many) Tj T* 0 Tw 2.92247 Tw (implementations of ) Tj /F4 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (in ) Tj 0 0 .501961 rg (http://www.python.org/moin/PythonDecoratorLibrary) Tj 0 0 0 rg (, but they do not) Tj T* 0 Tw 2.683984 Tw (preserve the signature. A simple implementation could be the following \(notice that in general it is) Tj T* 0 Tw (impossible to memoize correctly something that depends on non-hashable arguments\):) Tj T* ET
+BT 1 0 0 1 0 62 Tm .351235 Tw 12 TL /F1 10 Tf 0 0 0 rg (A very common use case for decorators is the memoization of functions. A ) Tj /F3 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (decorator works by) Tj T* 0 Tw .871988 Tw (caching the result of the function call in a dictionary, so that the next time the function is called with the) Tj T* 0 Tw 2.350651 Tw (same input parameters the result is retrieved from the cache and not recomputed. There are many) Tj T* 0 Tw 2.92247 Tw (implementations of ) Tj /F3 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (in ) Tj 0 0 .501961 rg (http://www.python.org/moin/PythonDecoratorLibrary) Tj 0 0 0 rg (, but they do not) Tj T* 0 Tw 2.683984 Tw (preserve the signature. A simple implementation could be the following \(notice that in general it is) Tj T* 0 Tw (impossible to memoize correctly something that depends on non-hashable arguments\):) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 137.8236 cm
+1 0 0 1 62.69291 95.82362 cm
q
q
1 0 0 1 0 0 cm
@@ -904,201 +967,201 @@ n -6 -6 468.6898 192 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 168.75 18 12 re f*
+n 0 168 18 12 re f*
.960784 .960784 .862745 rg
-n 24 168.75 60 12 re f*
+n 24 168 60 12 re f*
.960784 .960784 .862745 rg
-n 84 168.75 6 12 re f*
+n 84 168 6 12 re f*
.960784 .960784 .862745 rg
-n 90 168.75 24 12 re f*
+n 90 168 24 12 re f*
.960784 .960784 .862745 rg
-n 114 168.75 12 12 re f*
+n 114 168 12 12 re f*
.960784 .960784 .862745 rg
-n 24 156.75 24 12 re f*
+n 24 156 24 12 re f*
.960784 .960784 .862745 rg
-n 48 156.75 6 12 re f*
+n 48 156 6 12 re f*
.960784 .960784 .862745 rg
-n 54 156.75 30 12 re f*
+n 54 156 30 12 re f*
.960784 .960784 .862745 rg
-n 90 156.75 6 12 re f*
+n 90 156 6 12 re f*
.960784 .960784 .862745 rg
-n 102 156.75 12 12 re f*
+n 102 156 12 12 re f*
.960784 .960784 .862745 rg
-n 24 132.75 18 12 re f*
+n 24 132 18 12 re f*
.960784 .960784 .862745 rg
-n 48 132.75 42 12 re f*
+n 48 132 42 12 re f*
.960784 .960784 .862745 rg
-n 90 132.75 6 12 re f*
+n 90 132 6 12 re f*
.960784 .960784 .862745 rg
-n 96 132.75 6 12 re f*
+n 96 132 6 12 re f*
.960784 .960784 .862745 rg
-n 102 132.75 24 12 re f*
+n 102 132 24 12 re f*
.960784 .960784 .862745 rg
-n 126 132.75 6 12 re f*
+n 126 132 6 12 re f*
.960784 .960784 .862745 rg
-n 138 132.75 12 12 re f*
+n 138 132 12 12 re f*
.960784 .960784 .862745 rg
-n 150 132.75 12 12 re f*
+n 150 132 12 12 re f*
.960784 .960784 .862745 rg
-n 162 132.75 12 12 re f*
+n 162 132 12 12 re f*
.960784 .960784 .862745 rg
-n 48 120.75 12 12 re f*
+n 48 120 12 12 re f*
.960784 .960784 .862745 rg
-n 66 120.75 12 12 re f*
+n 66 120 12 12 re f*
.960784 .960784 .862745 rg
-n 78 120.75 6 12 re f*
+n 78 120 6 12 re f*
.960784 .960784 .862745 rg
-n 96 120.75 246 12 re f*
+n 96 120 246 12 re f*
.960784 .960784 .862745 rg
-n 72 108.75 18 12 re f*
+n 72 108 18 12 re f*
.960784 .960784 .862745 rg
-n 96 108.75 6 12 re f*
+n 96 108 6 12 re f*
.960784 .960784 .862745 rg
-n 108 108.75 24 12 re f*
+n 108 108 24 12 re f*
.960784 .960784 .862745 rg
-n 132 108.75 6 12 re f*
+n 132 108 6 12 re f*
.960784 .960784 .862745 rg
-n 144 108.75 54 12 re f*
+n 144 108 54 12 re f*
.960784 .960784 .862745 rg
-n 198 108.75 6 12 re f*
+n 198 108 6 12 re f*
.960784 .960784 .862745 rg
-n 204 108.75 12 12 re f*
+n 204 108 12 12 re f*
.960784 .960784 .862745 rg
-n 216 108.75 6 12 re f*
+n 216 108 6 12 re f*
.960784 .960784 .862745 rg
-n 222 108.75 54 12 re f*
+n 222 108 54 12 re f*
.960784 .960784 .862745 rg
-n 276 108.75 18 12 re f*
+n 276 108 18 12 re f*
.960784 .960784 .862745 rg
-n 48 96.75 24 12 re f*
+n 48 96 24 12 re f*
.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
+n 72 96 6 12 re f*
.960784 .960784 .862745 rg
-n 72 84.75 18 12 re f*
+n 72 84 18 12 re f*
.960784 .960784 .862745 rg
-n 96 84.75 6 12 re f*
+n 96 84 6 12 re f*
.960784 .960784 .862745 rg
-n 108 84.75 24 12 re f*
+n 108 84 24 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 30 12 re f*
+n 48 72 30 12 re f*
.960784 .960784 .862745 rg
-n 84 72.75 6 12 re f*
+n 84 72 6 12 re f*
.960784 .960784 .862745 rg
-n 96 72.75 24 12 re f*
+n 96 72 24 12 re f*
.960784 .960784 .862745 rg
-n 120 72.75 6 12 re f*
+n 120 72 6 12 re f*
.960784 .960784 .862745 rg
-n 126 72.75 30 12 re f*
+n 126 72 30 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 12 12 re f*
+n 48 60 12 12 re f*
.960784 .960784 .862745 rg
-n 66 60.75 18 12 re f*
+n 66 60 18 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 12 12 re f*
+n 90 60 12 12 re f*
.960784 .960784 .862745 rg
-n 108 60.75 30 12 re f*
+n 108 60 30 12 re f*
.960784 .960784 .862745 rg
-n 138 60.75 6 12 re f*
+n 138 60 6 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 36 12 re f*
+n 72 48 36 12 re f*
.960784 .960784 .862745 rg
-n 114 48.75 30 12 re f*
+n 114 48 30 12 re f*
.960784 .960784 .862745 rg
-n 144 48.75 6 12 re f*
+n 144 48 6 12 re f*
.960784 .960784 .862745 rg
-n 150 48.75 18 12 re f*
+n 150 48 18 12 re f*
.960784 .960784 .862745 rg
-n 168 48.75 6 12 re f*
+n 168 48 6 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
+n 48 36 24 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 72 36 6 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 30 12 re f*
+n 72 24 30 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 6 12 re f*
+n 102 24 6 12 re f*
.960784 .960784 .862745 rg
-n 108 24.75 18 12 re f*
+n 108 24 18 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
+n 126 24 6 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 6 12 re f*
+n 138 24 6 12 re f*
.960784 .960784 .862745 rg
-n 150 24.75 36 12 re f*
+n 150 24 36 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 6 12 re f*
+n 192 24 6 12 re f*
.960784 .960784 .862745 rg
-n 204 24.75 24 12 re f*
+n 204 24 24 12 re f*
.960784 .960784 .862745 rg
-n 228 24.75 6 12 re f*
+n 228 24 6 12 re f*
.960784 .960784 .862745 rg
-n 234 24.75 6 12 re f*
+n 234 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 24.75 24 12 re f*
+n 240 24 24 12 re f*
.960784 .960784 .862745 rg
-n 264 24.75 6 12 re f*
+n 264 24 6 12 re f*
.960784 .960784 .862745 rg
-n 276 24.75 12 12 re f*
+n 276 24 12 12 re f*
.960784 .960784 .862745 rg
-n 288 24.75 12 12 re f*
+n 288 24 12 12 re f*
.960784 .960784 .862745 rg
-n 300 24.75 6 12 re f*
+n 300 24 6 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 36 12 re f*
+n 72 12 36 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 36 12 re f*
+n 114 12 36 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
+n 66 0 54 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 84 12 re f*
+n 126 0 84 12 re f*
.960784 .960784 .862745 rg
-n 210 .75 6 12 re f*
+n 210 0 6 12 re f*
.960784 .960784 .862745 rg
-n 216 .75 42 12 re f*
+n 216 0 42 12 re f*
.960784 .960784 .862745 rg
-n 258 .75 6 12 re f*
+n 258 0 6 12 re f*
.960784 .960784 .862745 rg
-n 270 .75 24 12 re f*
+n 270 0 24 12 re f*
.960784 .960784 .862745 rg
-n 294 .75 6 12 re f*
-BT 1 0 0 1 0 170 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize_uw) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (functools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (update_wrapper) Tj 0 0 0 rg (\() Tj 0 0 0 rg (memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
+n 294 0 6 12 re f*
+BT 1 0 0 1 0 170 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize_uw) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (functools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (update_wrapper) Tj 0 0 0 rg (\() Tj 0 0 0 rg (memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
-q
-1 0 0 1 62.69291 81.82362 cm
-q
-BT 1 0 0 1 0 38 Tm 1.801412 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here we used the ) Tj 0 0 .501961 rg (functools.update_wrapper ) Tj 0 0 0 rg (utility, which has been added in Python 2.5 expressly to) Tj T* 0 Tw .91686 Tw (simplify the definition of decorators \(in older versions of Python you need to copy the function attributes) Tj T* 0 Tw .580814 Tw /F4 10 Tf 0 0 0 rg (__name__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (__module__ ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (__dict__ ) Tj /F1 10 Tf 0 0 0 rg (from the original function to the decorated function) Tj T* 0 Tw (by hand\).) Tj T* ET
-Q
-Q
endstream
endobj
-87 0 obj
-<< /Length 17189 >>
+98 0 obj
+<< /Length 15986 >>
stream
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 729.0236 cm
+1 0 0 1 62.69291 717.0236 cm
+q
+BT 1 0 0 1 0 38 Tm 1.801412 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here we used the ) Tj 0 0 .501961 rg (functools.update_wrapper ) Tj 0 0 0 rg (utility, which has been added in Python 2.5 expressly to) Tj T* 0 Tw .91686 Tw (simplify the definition of decorators \(in older versions of Python you need to copy the function attributes) Tj T* 0 Tw .580814 Tw /F3 10 Tf 0 0 0 rg (__name__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (__module__ ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (__dict__ ) Tj /F1 10 Tf 0 0 0 rg (from the original function to the decorated function) Tj T* 0 Tw (by hand\).) Tj T* ET
+Q
+Q
q
-BT 1 0 0 1 0 26 Tm 2.517126 Tw 12 TL /F1 10 Tf 0 0 0 rg (The implementation above works in the sense that the decorator can accept functions with generic) Tj T* 0 Tw 1.233615 Tw (signatures; unfortunately this implementation does ) Tj /F5 10 Tf (not ) Tj /F1 10 Tf (define a signature-preserving decorator, since in) Tj T* 0 Tw (general ) Tj /F4 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (returns a function with a ) Tj /F5 10 Tf (different signature ) Tj /F1 10 Tf (from the original function.) Tj T* ET
+1 0 0 1 62.69291 675.0236 cm
+q
+BT 1 0 0 1 0 26 Tm 2.517126 Tw 12 TL /F1 10 Tf 0 0 0 rg (The implementation above works in the sense that the decorator can accept functions with generic) Tj T* 0 Tw 1.233615 Tw (signatures; unfortunately this implementation does ) Tj /F4 10 Tf (not ) Tj /F1 10 Tf (define a signature-preserving decorator, since in) Tj T* 0 Tw (general ) Tj /F3 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (returns a function with a ) Tj /F4 10 Tf (different signature ) Tj /F1 10 Tf (from the original function.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 711.0236 cm
+1 0 0 1 62.69291 657.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Consider for instance the following case:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 641.8236 cm
+1 0 0 1 62.69291 587.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -1112,61 +1175,61 @@ n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 66 12 re f*
+n 24 36 66 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
+n 24 24 18 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 12 12 re f*
+n 48 24 12 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
+n 66 24 6 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 12 12 re f*
+n 72 24 12 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 24 12 re f*
+n 48 12 24 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
+n 72 12 6 12 re f*
.960784 .960784 .862745 rg
-n 78 12.75 30 12 re f*
+n 78 12 30 12 re f*
.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
+n 108 12 6 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 132 12.75 192 12 re f*
+n 132 12 192 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
+n 48 0 36 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize_uw) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate some long computation) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (x) Tj T* ET
+n 90 0 6 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize_uw) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate some long computation) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (x) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 609.8236 cm
+1 0 0 1 62.69291 555.8236 cm
q
-BT 1 0 0 1 0 14 Tm .26311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here the original function takes a single argument named ) Tj /F4 10 Tf 0 0 0 rg (x) Tj /F1 10 Tf 0 0 0 rg (, but the decorated function takes any number) Tj T* 0 Tw (of arguments and keyword arguments:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .26311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here the original function takes a single argument named ) Tj /F3 10 Tf 0 0 0 rg (x) Tj /F1 10 Tf 0 0 0 rg (, but the decorated function takes any number) Tj T* 0 Tw (of arguments and keyword arguments:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 552.6236 cm
+1 0 0 1 62.69291 498.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -1180,85 +1243,85 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 24 12 re f*
+n 24 24 24 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 42 12 re f*
+n 54 24 42 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 36 12 re f*
+n 102 24 36 12 re f*
.960784 .960784 .862745 rg
-n 144 24.75 60 12 re f*
+n 144 24 60 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 60 12 60 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 12 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 138 12.75 6 12 re f*
+n 126 12 12 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 174 12 re f*
+n 138 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
+n 42 0 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 72 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 18 12 re f*
+n 78 0 18 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 42 12 re f*
+n 102 0 42 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
+n 144 0 6 12 re f*
.960784 .960784 .862745 rg
-n 150 .75 36 12 re f*
+n 150 0 36 12 re f*
.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
+n 186 0 6 12 re f*
.960784 .960784 .862745 rg
-n 198 .75 48 12 re f*
+n 198 0 48 12 re f*
.960784 .960784 .862745 rg
-n 246 .75 6 12 re f*
+n 246 0 6 12 re f*
.960784 .960784 .862745 rg
-n 252 .75 24 12 re f*
+n 252 0 24 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
+n 276 0 6 12 re f*
.960784 .960784 .862745 rg
-n 288 .75 48 12 re f*
+n 288 0 48 12 re f*
.960784 .960784 .862745 rg
-n 336 .75 6 12 re f*
+n 336 0 6 12 re f*
.960784 .960784 .862745 rg
-n 342 .75 24 12 re f*
+n 342 0 24 12 re f*
.960784 .960784 .862745 rg
-n 366 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (inspect) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# I am using Python 2.6+ here) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
+n 366 0 6 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (from) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (inspect) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (import) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 508.6236 cm
+1 0 0 1 62.69291 454.6236 cm
q
-BT 1 0 0 1 0 26 Tm .411235 Tw 12 TL /F1 10 Tf 0 0 0 rg (This means that introspection tools such as pydoc will give wrong informations about the signature of ) Tj /F4 10 Tf 0 0 0 rg (f1) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* 0 Tw .161654 Tw (This is pretty bad: pydoc will tell you that the function accepts a generic signature ) Tj /F4 10 Tf 0 0 0 rg (*args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (**kw) Tj /F1 10 Tf 0 0 0 rg (, but when) Tj T* 0 Tw (you try to call the function with more than an argument, you will get an error:) Tj T* ET
+BT 1 0 0 1 0 26 Tm .411235 Tw 12 TL /F1 10 Tf 0 0 0 rg (This means that introspection tools such as pydoc will give wrong informations about the signature of ) Tj /F3 10 Tf 0 0 0 rg (f1) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* 0 Tw .161654 Tw (This is pretty bad: pydoc will tell you that the function accepts a generic signature ) Tj /F3 10 Tf 0 0 0 rg (*args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (**kw) Tj /F1 10 Tf 0 0 0 rg (, but when) Tj T* 0 Tw (you try to call the function with more than an argument, you will get an error:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 439.4236 cm
+1 0 0 1 62.69291 385.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -1272,83 +1335,85 @@ n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 12 12 re f*
+n 24 36 12 12 re f*
.960784 .960784 .862745 rg
-n 36 36.75 6 12 re f*
+n 36 36 6 12 re f*
.960784 .960784 .862745 rg
-n 42 36.75 6 12 re f*
+n 42 36 6 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
+n 48 36 6 12 re f*
.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
+n 60 36 6 12 re f*
.960784 .960784 .862745 rg
-n 66 36.75 6 12 re f*
+n 66 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 54 12 re f*
+n 0 24 54 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 24 12 re f*
+n 66 24 24 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 36 12 re f*
+n 96 24 36 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 24 12 re f*
+n 138 24 24 12 re f*
.960784 .960784 .862745 rg
-n 168 24.75 24 12 re f*
+n 168 24 24 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 12 12 re f*
+n 192 24 12 12 re f*
.960784 .960784 .862745 rg
-n 18 12.75 18 12 re f*
+n 18 12 18 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 54 12 re f*
+n 0 0 54 12 re f*
.960784 .960784 .862745 rg
-n 54 .75 6 12 re f*
+n 54 0 6 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 12 12 re f*
+n 66 0 12 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 12 12 re f*
+n 78 0 12 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 30 12 re f*
+n 96 0 30 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 42 12 re f*
+n 132 0 42 12 re f*
.960784 .960784 .862745 rg
-n 180 .75 6 12 re f*
+n 180 0 6 12 re f*
.960784 .960784 .862745 rg
-n 192 .75 48 12 re f*
+n 192 0 60 12 re f*
.960784 .960784 .862745 rg
-n 246 .75 6 12 re f*
+n 258 0 48 12 re f*
.960784 .960784 .862745 rg
-n 252 .75 6 12 re f*
+n 312 0 6 12 re f*
.960784 .960784 .862745 rg
-n 264 .75 30 12 re f*
+n 318 0 6 12 re f*
.960784 .960784 .862745 rg
-n 294 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (TypeError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (takes) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (exactly) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argument) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (given) Tj 0 0 0 rg (\)) Tj T* ET
+n 330 0 30 12 re f*
+.960784 .960784 .862745 rg
+n 360 0 6 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F5 10 Tf .823529 .254902 .227451 rg (TypeError) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (takes) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (exactly) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (positional) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argument) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (given) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 406.4236 cm
+1 0 0 1 62.69291 352.4236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (The solution) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 364.4236 cm
+1 0 0 1 62.69291 310.4236 cm
q
-BT 1 0 0 1 0 26 Tm 3.313984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The solution is to provide a generic factory of generators, which hides the complexity of making) Tj T* 0 Tw 3.362976 Tw (signature-preserving decorators from the application programmer. The ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function in the) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is such a factory:) Tj T* ET
+BT 1 0 0 1 0 26 Tm 3.313984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The solution is to provide a generic factory of generators, which hides the complexity of making) Tj T* 0 Tw 3.362976 Tw (signature-preserving decorators from the application programmer. The ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function in the) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is such a factory:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 331.2236 cm
+1 0 0 1 62.69291 277.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -1362,33 +1427,33 @@ n -6 -6 468.6898 24 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
+n 6 0 6 12 re f*
.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
+n 12 0 6 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
+n 24 0 24 12 re f*
.960784 .960784 .862745 rg
-n 54 .75 54 12 re f*
+n 54 0 54 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 36 12 re f*
+n 114 0 36 12 re f*
.960784 .960784 .862745 rg
-n 156 .75 54 12 re f*
-BT 1 0 0 1 0 2 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (decorator) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj T* ET
+n 156 0 54 12 re f*
+BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (from) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (decorator) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (import) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 275.2236 cm
+1 0 0 1 62.69291 221.2236 cm
q
-BT 1 0 0 1 0 38 Tm 1.716412 Tw 12 TL /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (takes two arguments, a caller function describing the functionality of the decorator and a) Tj T* 0 Tw 2.594983 Tw (function to be decorated; it returns the decorated function. The caller function must have signature) Tj T* 0 Tw .19311 Tw /F4 10 Tf 0 0 0 rg (\(f,) Tj ( ) Tj (*args,) Tj ( ) Tj (**kw\) ) Tj /F1 10 Tf 0 0 0 rg (and it must call the original function ) Tj /F4 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (with arguments ) Tj /F4 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (kw) Tj /F1 10 Tf 0 0 0 rg (, implementing) Tj T* 0 Tw (the wanted capability, i.e. memoization in this case:) Tj T* ET
+BT 1 0 0 1 0 38 Tm 1.716412 Tw 12 TL /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (takes two arguments, a caller function describing the functionality of the decorator and a) Tj T* 0 Tw 2.594983 Tw (function to be decorated; it returns the decorated function. The caller function must have signature) Tj T* 0 Tw .19311 Tw /F3 10 Tf 0 0 0 rg (\(f,) Tj ( ) Tj (*args,) Tj ( ) Tj (**kw\) ) Tj /F1 10 Tf 0 0 0 rg (and it must call the original function ) Tj /F3 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (with arguments ) Tj /F3 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (kw) Tj /F1 10 Tf 0 0 0 rg (, implementing) Tj T* 0 Tw (the wanted capability, i.e. memoization in this case:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 122.0236 cm
+1 0 0 1 62.69291 92.02362 cm
q
q
1 0 0 1 0 0 cm
@@ -1398,161 +1463,181 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 144 re B*
+n -6 -6 468.6898 120 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 120.75 18 12 re f*
+n 0 96 18 12 re f*
.960784 .960784 .862745 rg
-n 24 120.75 48 12 re f*
+n 24 96 48 12 re f*
.960784 .960784 .862745 rg
-n 72 120.75 6 12 re f*
+n 72 96 6 12 re f*
.960784 .960784 .862745 rg
-n 78 120.75 24 12 re f*
+n 78 96 24 12 re f*
.960784 .960784 .862745 rg
-n 102 120.75 6 12 re f*
+n 102 96 6 12 re f*
.960784 .960784 .862745 rg
-n 114 120.75 6 12 re f*
+n 114 96 6 12 re f*
.960784 .960784 .862745 rg
-n 120 120.75 24 12 re f*
+n 120 96 24 12 re f*
.960784 .960784 .862745 rg
-n 144 120.75 6 12 re f*
+n 144 96 6 12 re f*
.960784 .960784 .862745 rg
-n 156 120.75 12 12 re f*
+n 156 96 12 12 re f*
.960784 .960784 .862745 rg
-n 168 120.75 12 12 re f*
+n 168 96 12 12 re f*
.960784 .960784 .862745 rg
-n 180 120.75 12 12 re f*
+n 180 96 12 12 re f*
.960784 .960784 .862745 rg
-n 24 108.75 12 12 re f*
+n 24 84 12 12 re f*
.960784 .960784 .862745 rg
-n 42 108.75 12 12 re f*
+n 42 84 12 12 re f*
.960784 .960784 .862745 rg
-n 54 108.75 6 12 re f*
+n 54 84 6 12 re f*
.960784 .960784 .862745 rg
-n 72 108.75 246 12 re f*
+n 72 84 246 12 re f*
.960784 .960784 .862745 rg
-n 48 96.75 18 12 re f*
+n 48 72 18 12 re f*
.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
+n 72 72 6 12 re f*
.960784 .960784 .862745 rg
-n 84 96.75 24 12 re f*
+n 84 72 24 12 re f*
.960784 .960784 .862745 rg
-n 108 96.75 6 12 re f*
+n 108 72 6 12 re f*
.960784 .960784 .862745 rg
-n 120 96.75 54 12 re f*
+n 120 72 54 12 re f*
.960784 .960784 .862745 rg
-n 174 96.75 6 12 re f*
+n 174 72 6 12 re f*
.960784 .960784 .862745 rg
-n 180 96.75 12 12 re f*
+n 180 72 12 12 re f*
.960784 .960784 .862745 rg
-n 192 96.75 6 12 re f*
+n 192 72 6 12 re f*
.960784 .960784 .862745 rg
-n 198 96.75 54 12 re f*
+n 198 72 54 12 re f*
.960784 .960784 .862745 rg
-n 252 96.75 18 12 re f*
+n 252 72 18 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 24 12 re f*
+n 24 60 24 12 re f*
.960784 .960784 .862745 rg
-n 48 84.75 6 12 re f*
+n 48 60 6 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 18 12 re f*
+n 48 48 18 12 re f*
.960784 .960784 .862745 rg
-n 72 72.75 6 12 re f*
+n 72 48 6 12 re f*
.960784 .960784 .862745 rg
-n 84 72.75 24 12 re f*
+n 84 48 24 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 30 12 re f*
+n 24 36 30 12 re f*
.960784 .960784 .862745 rg
-n 60 60.75 6 12 re f*
+n 60 36 6 12 re f*
.960784 .960784 .862745 rg
-n 72 60.75 24 12 re f*
+n 72 36 24 12 re f*
.960784 .960784 .862745 rg
-n 96 60.75 6 12 re f*
+n 96 36 6 12 re f*
.960784 .960784 .862745 rg
-n 102 60.75 30 12 re f*
+n 102 36 30 12 re f*
.960784 .960784 .862745 rg
-n 144 60.75 174 12 re f*
+n 144 36 174 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 12 12 re f*
+n 24 24 12 12 re f*
.960784 .960784 .862745 rg
-n 42 48.75 18 12 re f*
+n 42 24 18 12 re f*
.960784 .960784 .862745 rg
-n 66 48.75 12 12 re f*
+n 66 24 12 12 re f*
.960784 .960784 .862745 rg
-n 84 48.75 30 12 re f*
+n 84 24 30 12 re f*
.960784 .960784 .862745 rg
-n 114 48.75 6 12 re f*
+n 114 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 36 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 30 12 re f*
+n 90 12 30 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 18 12 re f*
+n 126 12 18 12 re f*
.960784 .960784 .862745 rg
-n 144 36.75 6 12 re f*
+n 144 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 24 12 re f*
+n 24 0 24 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
+n 48 0 6 12 re f*
+BT 1 0 0 1 0 98 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# attributed added by memoize) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ET
+Q
+Q
+Q
+Q
+Q
+
+endstream
+endobj
+99 0 obj
+<< /Length 17966 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
+q
+1 0 0 1 62.69291 727.8236 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
+n -6 -6 468.6898 36 re B*
+Q
+q
+.960784 .960784 .862745 rg
+n 48 12 30 12 re f*
.960784 .960784 .862745 rg
-n 78 12.75 6 12 re f*
+n 78 12 6 12 re f*
.960784 .960784 .862745 rg
-n 84 12.75 18 12 re f*
+n 84 12 18 12 re f*
.960784 .960784 .862745 rg
-n 102 12.75 6 12 re f*
+n 102 12 6 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
+n 126 12 36 12 re f*
.960784 .960784 .862745 rg
-n 168 12.75 6 12 re f*
+n 168 12 6 12 re f*
.960784 .960784 .862745 rg
-n 180 12.75 24 12 re f*
+n 180 12 24 12 re f*
.960784 .960784 .862745 rg
-n 204 12.75 6 12 re f*
+n 204 12 6 12 re f*
.960784 .960784 .862745 rg
-n 210 12.75 6 12 re f*
+n 210 12 6 12 re f*
.960784 .960784 .862745 rg
-n 216 12.75 24 12 re f*
+n 216 12 24 12 re f*
.960784 .960784 .862745 rg
-n 240 12.75 6 12 re f*
+n 240 12 6 12 re f*
.960784 .960784 .862745 rg
-n 252 12.75 12 12 re f*
+n 252 12 12 12 re f*
.960784 .960784 .862745 rg
-n 264 12.75 12 12 re f*
+n 264 12 12 12 re f*
.960784 .960784 .862745 rg
-n 276 12.75 6 12 re f*
+n 276 12 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
+n 48 0 36 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 36 12 re f*
-BT 1 0 0 1 0 122 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# attributed added by memoize) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
+n 90 0 36 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 102.0236 cm
+1 0 0 1 62.69291 707.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (At this point you can define your decorator as follows:) Tj T* ET
Q
Q
-
-endstream
-endobj
-88 0 obj
-<< /Length 15826 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 715.8236 cm
+1 0 0 1 62.69291 650.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -1566,60 +1651,60 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 42 12 re f*
+n 24 24 42 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
+n 66 24 6 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 78 24.75 12 12 re f*
+n 78 24 12 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
+n 24 12 6 12 re f*
.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
+n 30 12 6 12 re f*
.960784 .960784 .862745 rg
-n 36 12.75 30 12 re f*
+n 36 12 30 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
+n 72 12 6 12 re f*
.960784 .960784 .862745 rg
-n 84 12.75 12 12 re f*
+n 84 12 12 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
+n 66 0 54 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 48 12 re f*
+n 126 0 48 12 re f*
.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
+n 174 0 6 12 re f*
.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
+n 186 0 6 12 re f*
.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
+n 192 0 6 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 671.8236 cm
+1 0 0 1 62.69291 606.6236 cm
q
-BT 1 0 0 1 0 26 Tm .12561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The difference with respect to the ) Tj /F4 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (approach, which is based on nested functions, is that the) Tj T* 0 Tw 2.59528 Tw (decorator module forces you to lift the inner function at the outer level \() Tj /F5 10 Tf (flat is better than nested) Tj /F1 10 Tf (\).) Tj T* 0 Tw (Moreover, you are forced to pass explicitly the function you want to decorate to the caller function.) Tj T* ET
+BT 1 0 0 1 0 26 Tm .12561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The difference with respect to the ) Tj /F3 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (approach, which is based on nested functions, is that the) Tj T* 0 Tw 2.59528 Tw (decorator module forces you to lift the inner function at the outer level \() Tj /F4 10 Tf (flat is better than nested) Tj /F1 10 Tf (\).) Tj T* 0 Tw (Moreover, you are forced to pass explicitly the function you want to decorate to the caller function.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 653.8236 cm
+1 0 0 1 62.69291 588.6236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is a test of usage:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 512.6236 cm
+1 0 0 1 62.69291 447.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -1633,87 +1718,91 @@ n -6 -6 468.6898 132 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 108.75 6 12 re f*
+n 0 108 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 108 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 108 6 12 re f*
.960784 .960784 .862745 rg
-n 6 108.75 6 12 re f*
+n 24 108 48 12 re f*
.960784 .960784 .862745 rg
-n 12 108.75 6 12 re f*
+n 0 96 18 12 re f*
.960784 .960784 .862745 rg
-n 24 108.75 48 12 re f*
+n 24 96 18 12 re f*
.960784 .960784 .862745 rg
-n 0 96.75 18 12 re f*
+n 48 96 102 12 re f*
.960784 .960784 .862745 rg
-n 24 96.75 18 12 re f*
+n 150 96 18 12 re f*
.960784 .960784 .862745 rg
-n 48 96.75 102 12 re f*
+n 0 84 18 12 re f*
.960784 .960784 .862745 rg
-n 150 96.75 18 12 re f*
+n 48 84 24 12 re f*
.960784 .960784 .862745 rg
-n 0 84.75 18 12 re f*
+n 72 84 6 12 re f*
.960784 .960784 .862745 rg
-n 48 84.75 24 12 re f*
+n 78 84 30 12 re f*
.960784 .960784 .862745 rg
-n 72 84.75 6 12 re f*
+n 108 84 6 12 re f*
.960784 .960784 .862745 rg
-n 78 84.75 30 12 re f*
+n 114 84 6 12 re f*
.960784 .960784 .862745 rg
-n 108 84.75 6 12 re f*
+n 120 84 6 12 re f*
.960784 .960784 .862745 rg
-n 114 84.75 6 12 re f*
+n 0 72 18 12 re f*
.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
+n 48 72 36 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 90 72 36 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 36 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 90 72.75 36 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 24 48 30 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 54 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 30 12 re f*
+n 60 48 102 12 re f*
.960784 .960784 .862745 rg
-n 60 48.75 102 12 re f*
+n 162 48 18 12 re f*
.960784 .960784 .862745 rg
-n 162 48.75 12 12 re f*
+n 186 48 234 12 re f*
.960784 .960784 .862745 rg
-n 180 48.75 234 12 re f*
+n 0 36 24 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 24 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 102 12 re f*
+n 60 12 102 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 12 12 re f*
+n 162 12 18 12 re f*
.960784 .960784 .862745 rg
-n 180 12.75 252 12 re f*
+n 186 12 252 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 24 12 re f*
-BT 1 0 0 1 0 110 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (heavy_computation) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("done") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the first time it will take 2 seconds) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the second time it will be instantaneous) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj T* ET
+n 0 0 24 12 re f*
+BT 1 0 0 1 0 110 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (heavy_computation) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("done") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the first time it will take 2 seconds) Tj /F3 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the second time it will be instantaneous) Tj /F3 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 492.6236 cm
+1 0 0 1 62.69291 427.4236 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (The signature of ) Tj /F4 10 Tf 0 0 0 rg (heavy_computation ) Tj /F1 10 Tf 0 0 0 rg (is the one you would expect:) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (The signature of ) Tj /F3 10 Tf 0 0 0 rg (heavy_computation ) Tj /F1 10 Tf 0 0 0 rg (is the one you would expect:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 447.4236 cm
+1 0 0 1 62.69291 382.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -1727,75 +1816,77 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
+n 60 12 60 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 102 12 re f*
+n 126 12 102 12 re f*
.960784 .960784 .862745 rg
-n 228 12.75 6 12 re f*
+n 228 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
+n 42 0 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 72 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 18 12 re f*
+n 78 0 18 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 42 12 re f*
+n 102 0 42 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
+n 144 0 6 12 re f*
.960784 .960784 .862745 rg
-n 150 .75 24 12 re f*
+n 150 0 24 12 re f*
.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
+n 174 0 6 12 re f*
.960784 .960784 .862745 rg
-n 186 .75 48 12 re f*
+n 186 0 48 12 re f*
.960784 .960784 .862745 rg
-n 234 .75 6 12 re f*
+n 234 0 6 12 re f*
.960784 .960784 .862745 rg
-n 240 .75 24 12 re f*
+n 240 0 24 12 re f*
.960784 .960784 .862745 rg
-n 264 .75 6 12 re f*
+n 264 0 6 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 48 12 re f*
+n 276 0 48 12 re f*
.960784 .960784 .862745 rg
-n 324 .75 6 12 re f*
+n 324 0 6 12 re f*
.960784 .960784 .862745 rg
-n 330 .75 24 12 re f*
+n 330 0 24 12 re f*
.960784 .960784 .862745 rg
-n 354 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
+n 354 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 414.4236 cm
+1 0 0 1 62.69291 349.2236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (A ) Tj /F3 17.5 Tf 0 0 0 rg (trace ) Tj /F2 17.5 Tf 0 0 0 rg (decorator) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 384.4236 cm
+1 0 0 1 62.69291 319.2236 cm
q
-BT 1 0 0 1 0 14 Tm .479398 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an additional example, here is how you can define a trivial ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (decorator, which prints a message) Tj T* 0 Tw (everytime the traced function is called:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .479398 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an additional example, here is how you can define a trivial ) Tj /F3 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (decorator, which prints a message) Tj T* 0 Tw (everytime the traced function is called:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 327.2236 cm
+1 0 0 1 62.69291 250.0236 cm
q
q
1 0 0 1 0 0 cm
@@ -1805,93 +1896,147 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
+n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 36 18 12 re f*
+.960784 .960784 .862745 rg
+n 24 36 36 12 re f*
+.960784 .960784 .862745 rg
+n 60 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 66 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 72 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 84 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
+n 90 36 24 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 114 36 6 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
+n 126 36 12 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
+n 138 36 12 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
+n 150 36 12 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 24 12 re f*
+n 24 24 30 12 re f*
.960784 .960784 .862745 rg
-n 114 24.75 6 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 12 12 re f*
+n 72 24 24 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
+n 96 24 6 12 re f*
.960784 .960784 .862745 rg
-n 150 24.75 12 12 re f*
+n 102 24 24 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 126 24 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
+n 132 24 6 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 12 12 re f*
+n 138 24 12 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 66 12 re f*
+n 150 24 6 12 re f*
.960784 .960784 .862745 rg
-n 192 12.75 12 12 re f*
+n 162 24 12 12 re f*
.960784 .960784 .862745 rg
-n 204 12.75 12 12 re f*
+n 174 24 6 12 re f*
.960784 .960784 .862745 rg
-n 216 12.75 12 12 re f*
+n 186 24 6 12 re f*
.960784 .960784 .862745 rg
-n 228 12.75 6 12 re f*
+n 198 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 12.75 6 12 re f*
+n 204 24 6 12 re f*
.960784 .960784 .862745 rg
-n 252 12.75 6 12 re f*
+n 210 24 6 12 re f*
.960784 .960784 .862745 rg
-n 258 12.75 6 12 re f*
+n 222 24 12 12 re f*
.960784 .960784 .862745 rg
-n 264 12.75 6 12 re f*
+n 234 24 6 12 re f*
.960784 .960784 .862745 rg
-n 270 12.75 48 12 re f*
+n 240 24 6 12 re f*
.960784 .960784 .862745 rg
-n 318 12.75 6 12 re f*
+n 246 24 12 12 re f*
.960784 .960784 .862745 rg
-n 330 12.75 24 12 re f*
+n 264 24 18 12 re f*
.960784 .960784 .862745 rg
-n 354 12.75 6 12 re f*
+n 288 24 6 12 re f*
.960784 .960784 .862745 rg
-n 366 12.75 12 12 re f*
+n 300 24 12 12 re f*
.960784 .960784 .862745 rg
-n 378 12.75 6 12 re f*
+n 318 24 36 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 354 24 6 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 6 12 re f*
+n 360 24 12 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 372 24 12 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 84 .75 24 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 108 .75 6 12 re f*
+n 60 12 48 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 12 12 re f*
+n 114 12 12 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 12 12 re f*
+n 126 12 60 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("calling ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (, ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
+n 192 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 204 12 18 12 re f*
+.960784 .960784 .862745 rg
+n 222 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 234 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 252 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 264 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 270 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 276 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 282 12 48 12 re f*
+.960784 .960784 .862745 rg
+n 330 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 342 12 24 12 re f*
+.960784 .960784 .862745 rg
+n 366 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 378 12 30 12 re f*
+.960784 .960784 .862745 rg
+n 408 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 24 0 36 12 re f*
+.960784 .960784 .862745 rg
+n 66 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 72 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 78 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 84 0 24 12 re f*
+.960784 .960784 .862745 rg
+n 108 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 120 0 12 12 re f*
+.960784 .960784 .862745 rg
+n 132 0 12 12 re f*
+.960784 .960784 .862745 rg
+n 144 0 6 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (', ') Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (join) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg (') Tj /F5 10 Tf .733333 .4 .533333 rg (%r) Tj /F3 10 Tf .729412 .129412 .129412 rg (: ) Tj /F5 10 Tf .733333 .4 .533333 rg (%r) Tj /F3 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (k) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg ([) Tj 0 0 0 rg (k) Tj 0 0 0 rg (]\)) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (for) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (k) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (sorted) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("calling ) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (, {) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (}") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 282.0236 cm
+1 0 0 1 62.69291 204.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -1905,44 +2050,44 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
+n 60 12 6 12 re f*
.960784 .960784 .862745 rg
-n 66 12.75 12 12 re f*
+n 66 12 12 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
+n 66 0 54 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 36 12 re f*
+n 126 0 36 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
+n 162 0 6 12 re f*
.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
+n 174 0 6 12 re f*
.960784 .960784 .862745 rg
-n 180 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_trace) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
+n 180 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_trace) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 262.0236 cm
+1 0 0 1 62.69291 184.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of usage:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 204.8236 cm
+1 0 0 1 62.69291 127.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -1956,43 +2101,50 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
+n 24 24 36 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 18 12 re f*
+n 24 12 18 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 12 12 re f*
+n 48 12 12 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
+n 60 12 6 12 re f*
.960784 .960784 .862745 rg
-n 66 12.75 6 12 re f*
+n 66 12 6 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 12 12 re f*
+n 72 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
+n 48 0 24 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 184.8236 cm
+1 0 0 1 62.69291 107.6236 cm
q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (It is immediate to verify that ) Tj /F4 10 Tf 0 0 0 rg (f1 ) Tj /F1 10 Tf 0 0 0 rg (works) Tj T* ET
+BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (It is immediate to verify that ) Tj /F3 10 Tf 0 0 0 rg (f1 ) Tj /F1 10 Tf 0 0 0 rg (works) Tj T* ET
Q
Q
+
+endstream
+endobj
+100 0 obj
+<< /Length 20723 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 139.6236 cm
+1 0 0 1 62.69291 727.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -2006,57 +2158,50 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 12 12 re f*
+n 24 12 12 12 re f*
.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
+n 36 12 6 12 re f*
.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
+n 42 12 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
+n 48 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 12 12 re f*
+n 48 0 12 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 24 12 re f*
+n 66 0 24 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 24 12 re f*
+n 96 0 24 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
+n 126 0 6 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
+n 138 0 18 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
+n 162 0 12 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (with) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 119.6236 cm
+1 0 0 1 62.69291 707.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (and it that it has the correct signature:) Tj T* ET
Q
Q
-
-endstream
-endobj
-89 0 obj
-<< /Length 22325 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 727.8236 cm
+1 0 0 1 62.69291 662.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -2070,74 +2215,76 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
+n 60 12 60 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 12 12 re f*
+n 126 12 12 12 re f*
.960784 .960784 .862745 rg
-n 138 12.75 6 12 re f*
+n 138 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
+n 42 0 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 72 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
+n 78 0 6 12 re f*
.960784 .960784 .862745 rg
-n 84 .75 18 12 re f*
+n 84 0 18 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 12 12 re f*
+n 102 0 12 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 42 12 re f*
+n 120 0 42 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
+n 162 0 6 12 re f*
.960784 .960784 .862745 rg
-n 168 .75 24 12 re f*
+n 168 0 24 12 re f*
.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
+n 192 0 6 12 re f*
.960784 .960784 .862745 rg
-n 204 .75 48 12 re f*
+n 204 0 48 12 re f*
.960784 .960784 .862745 rg
-n 252 .75 6 12 re f*
+n 252 0 6 12 re f*
.960784 .960784 .862745 rg
-n 258 .75 24 12 re f*
+n 258 0 24 12 re f*
.960784 .960784 .862745 rg
-n 282 .75 6 12 re f*
+n 282 0 6 12 re f*
.960784 .960784 .862745 rg
-n 294 .75 48 12 re f*
+n 294 0 48 12 re f*
.960784 .960784 .862745 rg
-n 342 .75 6 12 re f*
+n 342 0 6 12 re f*
.960784 .960784 .862745 rg
-n 348 .75 24 12 re f*
+n 348 0 24 12 re f*
.960784 .960784 .862745 rg
-n 372 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
+n 372 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 707.8236 cm
+1 0 0 1 62.69291 642.6236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The same decorator works with functions of any signature:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 578.6236 cm
+1 0 0 1 62.69291 513.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -2151,182 +2298,189 @@ n -6 -6 474 120 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
+n 0 96 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 96 6 12 re f*
.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
+n 12 96 6 12 re f*
.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
+n 24 96 36 12 re f*
.960784 .960784 .862745 rg
-n 24 96.75 36 12 re f*
+n 0 84 18 12 re f*
.960784 .960784 .862745 rg
-n 0 84.75 18 12 re f*
+n 24 84 18 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 18 12 re f*
+n 48 84 6 12 re f*
.960784 .960784 .862745 rg
-n 48 84.75 6 12 re f*
+n 54 84 6 12 re f*
.960784 .960784 .862745 rg
-n 54 84.75 6 12 re f*
+n 60 84 6 12 re f*
.960784 .960784 .862745 rg
-n 60 84.75 6 12 re f*
+n 66 84 6 12 re f*
.960784 .960784 .862745 rg
-n 66 84.75 6 12 re f*
+n 78 84 6 12 re f*
.960784 .960784 .862745 rg
-n 78 84.75 6 12 re f*
+n 84 84 6 12 re f*
.960784 .960784 .862745 rg
-n 84 84.75 6 12 re f*
+n 90 84 6 12 re f*
.960784 .960784 .862745 rg
-n 90 84.75 6 12 re f*
+n 96 84 6 12 re f*
.960784 .960784 .862745 rg
-n 96 84.75 6 12 re f*
+n 108 84 6 12 re f*
.960784 .960784 .862745 rg
-n 108 84.75 6 12 re f*
+n 114 84 6 12 re f*
.960784 .960784 .862745 rg
-n 114 84.75 6 12 re f*
+n 120 84 6 12 re f*
.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
+n 126 84 6 12 re f*
.960784 .960784 .862745 rg
-n 126 84.75 6 12 re f*
+n 138 84 6 12 re f*
.960784 .960784 .862745 rg
-n 138 84.75 6 12 re f*
+n 144 84 24 12 re f*
.960784 .960784 .862745 rg
-n 144 84.75 24 12 re f*
+n 168 84 6 12 re f*
.960784 .960784 .862745 rg
-n 168 84.75 6 12 re f*
+n 180 84 12 12 re f*
.960784 .960784 .862745 rg
-n 180 84.75 12 12 re f*
+n 192 84 12 12 re f*
.960784 .960784 .862745 rg
-n 192 84.75 12 12 re f*
+n 204 84 12 12 re f*
.960784 .960784 .862745 rg
-n 204 84.75 12 12 re f*
+n 0 72 18 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 48 72 24 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 24 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 24 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 6 12 re f*
+n 30 48 6 12 re f*
.960784 .960784 .862745 rg
-n 30 48.75 6 12 re f*
+n 36 48 6 12 re f*
.960784 .960784 .862745 rg
-n 36 48.75 6 12 re f*
+n 42 48 6 12 re f*
.960784 .960784 .862745 rg
-n 42 48.75 6 12 re f*
+n 54 48 6 12 re f*
.960784 .960784 .862745 rg
-n 54 48.75 6 12 re f*
+n 60 48 6 12 re f*
.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
+n 0 36 42 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 42 12 re f*
+n 48 36 6 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
+n 60 36 24 12 re f*
.960784 .960784 .862745 rg
-n 60 36.75 24 12 re f*
+n 90 36 24 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 24 12 re f*
+n 120 36 6 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
+n 126 36 6 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 6 12 re f*
+n 132 36 6 12 re f*
.960784 .960784 .862745 rg
-n 132 36.75 6 12 re f*
+n 144 36 6 12 re f*
.960784 .960784 .862745 rg
-n 144 36.75 6 12 re f*
+n 150 36 6 12 re f*
.960784 .960784 .862745 rg
-n 150 36.75 6 12 re f*
+n 162 36 6 12 re f*
.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
+n 168 36 12 12 re f*
.960784 .960784 .862745 rg
-n 168 36.75 12 12 re f*
+n 186 36 12 12 re f*
.960784 .960784 .862745 rg
-n 186 36.75 12 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
+n 60 12 60 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
+n 126 12 6 12 re f*
.960784 .960784 .862745 rg
-n 132 12.75 6 12 re f*
+n 132 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
+n 42 0 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 72 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
+n 78 0 6 12 re f*
.960784 .960784 .862745 rg
-n 84 .75 18 12 re f*
+n 84 0 18 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
+n 102 0 6 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 18 12 re f*
+n 114 0 18 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 18 12 re f*
+n 144 0 18 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
+n 162 0 12 12 re f*
.960784 .960784 .862745 rg
-n 180 .75 42 12 re f*
+n 180 0 42 12 re f*
.960784 .960784 .862745 rg
-n 222 .75 6 12 re f*
+n 222 0 6 12 re f*
.960784 .960784 .862745 rg
-n 228 .75 36 12 re f*
+n 228 0 36 12 re f*
.960784 .960784 .862745 rg
-n 264 .75 6 12 re f*
+n 264 0 6 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 48 12 re f*
+n 276 0 48 12 re f*
.960784 .960784 .862745 rg
-n 324 .75 6 12 re f*
+n 324 0 6 12 re f*
.960784 .960784 .862745 rg
-n 330 .75 24 12 re f*
+n 330 0 24 12 re f*
.960784 .960784 .862745 rg
-n 354 .75 6 12 re f*
+n 354 0 6 12 re f*
.960784 .960784 .862745 rg
-n 366 .75 48 12 re f*
+n 366 0 48 12 re f*
.960784 .960784 .862745 rg
-n 414 .75 6 12 re f*
+n 414 0 6 12 re f*
.960784 .960784 .862745 rg
-n 420 .75 6 12 re f*
+n 420 0 6 12 re f*
.960784 .960784 .862745 rg
-n 426 .75 6 12 re f*
+n 426 0 6 12 re f*
.960784 .960784 .862745 rg
-n 432 .75 6 12 re f*
+n 432 0 6 12 re f*
.960784 .960784 .862745 rg
-n 444 .75 6 12 re f*
+n 444 0 6 12 re f*
.960784 .960784 .862745 rg
-n 450 .75 12 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (z) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('z') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)\)) Tj T* ET
+n 450 0 12 12 re f*
+BT 1 0 0 1 0 98 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (z) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (with) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('z') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 558.6236 cm
+1 0 0 1 62.69291 480.4236 cm
q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (That includes even functions with exotic signatures like the following:) Tj T* ET
+BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Function annotations) Tj T* ET
+Q
+Q
+q
+1 0 0 1 62.69291 426.4236 cm
+q
+BT 1 0 0 1 0 38 Tm 1.937318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Python 3 introduced the concept of ) Tj 0 0 .501961 rg (function annotations) Tj 0 0 0 rg (,i.e. the ability to annotate the signature of a) Tj T* 0 Tw 2.24816 Tw (function with additional information, stored in a dictionary named ) Tj /F3 10 Tf 0 0 0 rg (__annotations__) Tj /F1 10 Tf 0 0 0 rg (. The decorator) Tj T* 0 Tw 1.923735 Tw (module, starting from release 3.3, is able to understand and to preserve the annotations. Here is an) Tj T* 0 Tw (example:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 441.4236 cm
+1 0 0 1 62.69291 357.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -2336,176 +2490,325 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
+n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
+n 0 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 36 36 12 re f*
+.960784 .960784 .862745 rg
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
+n 24 24 18 12 re f*
.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
+n 48 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 36 12 re f*
+n 54 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
+n 66 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 96 12 re f*
+n 78 24 120 12 re f*
.960784 .960784 .862745 rg
-n 144 72.75 12 12 re f*
+n 198 24 6 12 re f*
.960784 .960784 .862745 rg
-n 156 72.75 6 12 re f*
+n 210 24 6 12 re f*
.960784 .960784 .862745 rg
-n 162 72.75 6 12 re f*
+n 216 24 6 12 re f*
.960784 .960784 .862745 rg
-n 174 72.75 6 12 re f*
+n 228 24 108 12 re f*
.960784 .960784 .862745 rg
-n 180 72.75 6 12 re f*
+n 336 24 6 12 re f*
.960784 .960784 .862745 rg
-n 186 72.75 6 12 re f*
+n 342 24 6 12 re f*
.960784 .960784 .862745 rg
-n 192 72.75 6 12 re f*
+n 348 24 6 12 re f*
.960784 .960784 .862745 rg
-n 198 72.75 6 12 re f*
+n 360 24 6 12 re f*
.960784 .960784 .862745 rg
-n 204 72.75 6 12 re f*
+n 366 24 6 12 re f*
.960784 .960784 .862745 rg
-n 210 72.75 6 12 re f*
+n 372 24 6 12 re f*
.960784 .960784 .862745 rg
-n 216 72.75 18 12 re f*
+n 378 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 72.75 36 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 282 72.75 6 12 re f*
+n 60 12 6 12 re f*
.960784 .960784 .862745 rg
-n 288 72.75 6 12 re f*
+n 66 12 24 12 re f*
.960784 .960784 .862745 rg
-n 294 72.75 6 12 re f*
+n 90 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 102 12 54 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 156 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 168 12 12 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 30 12 re f*
+n 180 12 12 12 re f*
.960784 .960784 .862745 rg
-n 60 48.75 60 12 re f*
+n 192 12 6 12 re f*
.960784 .960784 .862745 rg
-n 120 48.75 6 12 re f*
+n 204 12 48 12 re f*
.960784 .960784 .862745 rg
-n 126 48.75 96 12 re f*
+n 252 12 12 12 re f*
.960784 .960784 .862745 rg
-n 222 48.75 6 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 42 12 re f*
+n 48 0 24 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('the first argument') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('default argument') Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (z) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('varargs') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('kwargs') Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj T* ET
+Q
+Q
+Q
+Q
+Q
+q
+1 0 0 1 62.69291 325.2236 cm
+q
+BT 1 0 0 1 0 14 Tm .596647 Tw 12 TL /F1 10 Tf 0 0 0 rg (In order to introspect functions with annotations, one needs the utility ) Tj /F3 10 Tf 0 0 0 rg (inspect.getfullargspec) Tj /F1 10 Tf 0 0 0 rg (, new) Tj T* 0 Tw (in Python 3:) Tj T* ET
+Q
+Q
+q
+1 0 0 1 62.69291 148.0236 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
+.960784 .960784 .862745 rg
+n -6 -6 468.6898 168 re B*
+Q
+q
+.960784 .960784 .862745 rg
+n 0 144 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 144 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 144 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 144 24 12 re f*
+.960784 .960784 .862745 rg
+n 54 144 42 12 re f*
+.960784 .960784 .862745 rg
+n 102 144 36 12 re f*
+.960784 .960784 .862745 rg
+n 144 144 84 12 re f*
.960784 .960784 .862745 rg
-n 42 36.75 6 12 re f*
+n 0 132 6 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
+n 6 132 6 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 12 132 6 12 re f*
.960784 .960784 .862745 rg
-n 78 36.75 12 12 re f*
+n 24 132 42 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 18 12 re f*
+n 72 132 6 12 re f*
.960784 .960784 .862745 rg
-n 108 36.75 6 12 re f*
+n 84 132 84 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 18 12 re f*
+n 168 132 6 12 re f*
.960784 .960784 .862745 rg
-n 138 36.75 18 12 re f*
+n 174 132 6 12 re f*
.960784 .960784 .862745 rg
-n 162 36.75 42 12 re f*
+n 180 132 6 12 re f*
.960784 .960784 .862745 rg
-n 204 36.75 6 12 re f*
+n 0 120 6 12 re f*
.960784 .960784 .862745 rg
-n 210 36.75 24 12 re f*
+n 6 120 6 12 re f*
.960784 .960784 .862745 rg
-n 234 36.75 6 12 re f*
+n 12 120 6 12 re f*
.960784 .960784 .862745 rg
-n 246 36.75 48 12 re f*
+n 24 120 42 12 re f*
.960784 .960784 .862745 rg
-n 294 36.75 6 12 re f*
+n 66 120 6 12 re f*
.960784 .960784 .862745 rg
-n 300 36.75 24 12 re f*
+n 72 120 24 12 re f*
.960784 .960784 .862745 rg
-n 324 36.75 6 12 re f*
+n 0 108 6 12 re f*
.960784 .960784 .862745 rg
-n 336 36.75 48 12 re f*
+n 6 108 18 12 re f*
.960784 .960784 .862745 rg
-n 384 36.75 6 12 re f*
+n 24 108 6 12 re f*
.960784 .960784 .862745 rg
-n 390 36.75 12 12 re f*
+n 36 108 18 12 re f*
.960784 .960784 .862745 rg
-n 402 36.75 6 12 re f*
+n 54 108 6 12 re f*
.960784 .960784 .862745 rg
-n 408 36.75 6 12 re f*
+n 66 108 18 12 re f*
.960784 .960784 .862745 rg
-n 420 36.75 6 12 re f*
+n 84 108 6 12 re f*
.960784 .960784 .862745 rg
-n 426 36.75 24 12 re f*
+n 0 96 6 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 6 96 6 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 12 96 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 24 96 42 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 96 12 re f*
+n 66 96 6 12 re f*
.960784 .960784 .862745 rg
-n 120 24.75 12 12 re f*
+n 72 96 42 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 42 12 re f*
+n 0 84 36 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 96 12 re f*
+n 0 72 6 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 24 12 re f*
+n 6 72 6 12 re f*
.960784 .960784 .862745 rg
-n 180 12.75 24 12 re f*
+n 12 72 6 12 re f*
.960784 .960784 .862745 rg
-n 210 12.75 12 12 re f*
+n 24 72 42 12 re f*
.960784 .960784 .862745 rg
-n 222 12.75 6 12 re f*
+n 66 72 6 12 re f*
.960784 .960784 .862745 rg
-n 228 12.75 6 12 re f*
+n 72 72 30 12 re f*
.960784 .960784 .862745 rg
-n 240 12.75 6 12 re f*
+n 0 60 24 12 re f*
.960784 .960784 .862745 rg
-n 246 12.75 24 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 276 12.75 12 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (exotic_signature) Tj 0 0 0 rg (\(\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (+) Tj 0 0 0 rg (y) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (exotic_signature) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([[) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (]],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (\(\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\),\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (exotic_signature) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (exotic_signature) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\(\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\),\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* .4 .4 .4 rg (3) Tj T* ET
+n 12 48 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 48 42 12 re f*
+.960784 .960784 .862745 rg
+n 66 48 6 12 re f*
+.960784 .960784 .862745 rg
+n 72 48 48 12 re f*
+.960784 .960784 .862745 rg
+n 0 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 30 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 0 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 24 42 12 re f*
+.960784 .960784 .862745 rg
+n 66 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 72 24 60 12 re f*
+.960784 .960784 .862745 rg
+n 0 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 0 42 12 re f*
+.960784 .960784 .862745 rg
+n 66 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 72 0 84 12 re f*
+BT 1 0 0 1 0 146 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (from) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (inspect) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (import) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getfullargspec) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (getfullargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('z') Tj 0 0 0 rg (]) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (varargs) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (varkw) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (defaults) Tj 0 0 0 rg T* 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (kwonlyargs) Tj 0 0 0 rg T* 0 0 0 rg ([]) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (kwonlydefaults) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 409.4236 cm
+1 0 0 1 62.69291 128.0236 cm
+q
+BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (You can also check that the ) Tj /F3 10 Tf 0 0 0 rg (__annotations__ ) Tj /F1 10 Tf 0 0 0 rg (dictionary is preserved:) Tj T* ET
+Q
+Q
+q
+1 0 0 1 62.69291 82.82362 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
+.960784 .960784 .862745 rg
+n -6 -6 468.6898 36 re B*
+Q
+q
+.960784 .960784 .862745 rg
+n 0 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 30 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 36 12 90 12 re f*
+.960784 .960784 .862745 rg
+n 132 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 150 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 156 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 162 12 66 12 re f*
+.960784 .960784 .862745 rg
+n 228 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 234 12 90 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 24 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__annotations__) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__wrapped__) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__annotations__) Tj 0 0 0 rg T* 0 .501961 0 rg (True) Tj T* ET
+Q
+Q
+Q
+Q
+Q
+
+endstream
+endobj
+101 0 obj
+<< /Length 18638 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
+q
+1 0 0 1 62.69291 741.0236 cm
q
0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .84561 Tw (Notice that the support for exotic signatures has been deprecated in Python 2.6 and removed in Python) Tj T* 0 Tw (3.0.) Tj T* ET
+BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .011098 Tw (Depending on the version of the decorator module, the two dictionaries can be the same object or not: you) Tj T* 0 Tw (cannot rely on object identity, but you can rely on the content being the same.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 376.4236 cm
+1 0 0 1 62.69291 708.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (decorator ) Tj /F2 17.5 Tf 0 0 0 rg (is a decorator) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 274.4236 cm
+1 0 0 1 62.69291 606.0236 cm
q
-BT 1 0 0 1 0 86 Tm .643876 Tw 12 TL /F1 10 Tf 0 0 0 rg (It may be annoying to write a caller function \(like the ) Tj /F4 10 Tf 0 0 0 rg (_trace ) Tj /F1 10 Tf 0 0 0 rg (function above\) and then a trivial wrapper) Tj T* 0 Tw 1.510888 Tw (\() Tj /F4 10 Tf 0 0 0 rg (def) Tj ( ) Tj (trace\(f\):) Tj ( ) Tj (return) Tj ( ) Tj (decorator\(_trace,) Tj ( ) Tj (f\)) Tj /F1 10 Tf 0 0 0 rg (\) every time. For this reason, the ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj T* 0 Tw .334269 Tw /F1 10 Tf 0 0 0 rg (module provides an easy shortcut to convert the caller function into a signature-preserving decorator: you) Tj T* 0 Tw 7.364269 Tw (can just call ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (with a single argument. In our example you can just write) Tj T* 0 Tw .951647 Tw /F4 10 Tf 0 0 0 rg (trace) Tj ( ) Tj (=) Tj ( ) Tj (decorator\(_trace\)) Tj /F1 10 Tf 0 0 0 rg (. The ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function can also be used as a signature-changing) Tj T* 0 Tw 1.077752 Tw (decorator, just as ) Tj /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (staticmethod) Tj /F1 10 Tf 0 0 0 rg (. However, ) Tj /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (staticmethod) Tj T* 0 Tw .531797 Tw /F1 10 Tf 0 0 0 rg (return generic objects which are not callable, while ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (returns signature-preserving decorators,) Tj T* 0 Tw (i.e. functions of a single argument. For instance, you can write directly) Tj T* ET
+BT 1 0 0 1 0 86 Tm .643876 Tw 12 TL /F1 10 Tf 0 0 0 rg (It may be annoying to write a caller function \(like the ) Tj /F3 10 Tf 0 0 0 rg (_trace ) Tj /F1 10 Tf 0 0 0 rg (function above\) and then a trivial wrapper) Tj T* 0 Tw 1.510888 Tw (\() Tj /F3 10 Tf 0 0 0 rg (def) Tj ( ) Tj (trace\(f\):) Tj ( ) Tj (return) Tj ( ) Tj (decorator\(_trace,) Tj ( ) Tj (f\)) Tj /F1 10 Tf 0 0 0 rg (\) every time. For this reason, the ) Tj /F3 10 Tf 0 0 0 rg (decorator) Tj T* 0 Tw .334269 Tw /F1 10 Tf 0 0 0 rg (module provides an easy shortcut to convert the caller function into a signature-preserving decorator: you) Tj T* 0 Tw 7.364269 Tw (can just call ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (with a single argument. In our example you can just write) Tj T* 0 Tw .951647 Tw /F3 10 Tf 0 0 0 rg (trace) Tj ( ) Tj (=) Tj ( ) Tj (decorator\(_trace\)) Tj /F1 10 Tf 0 0 0 rg (. The ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function can also be used as a signature-changing) Tj T* 0 Tw 1.077752 Tw (decorator, just as ) Tj /F3 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (staticmethod) Tj /F1 10 Tf 0 0 0 rg (. However, ) Tj /F3 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (staticmethod) Tj T* 0 Tw .531797 Tw /F1 10 Tf 0 0 0 rg (return generic objects which are not callable, while ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (returns signature-preserving decorators,) Tj T* 0 Tw (i.e. functions of a single argument. For instance, you can write directly) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 205.2236 cm
+1 0 0 1 62.69291 524.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -2515,113 +2818,169 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
+n -6 -6 468.6898 72 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 0 48 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 48 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 48 6 12 re f*
+.960784 .960784 .862745 rg
+n 24 48 60 12 re f*
+.960784 .960784 .862745 rg
+n 0 36 18 12 re f*
+.960784 .960784 .862745 rg
+n 24 36 18 12 re f*
+.960784 .960784 .862745 rg
+n 48 36 30 12 re f*
+.960784 .960784 .862745 rg
+n 78 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 84 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 90 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 102 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 108 36 24 12 re f*
+.960784 .960784 .862745 rg
+n 132 36 6 12 re f*
+.960784 .960784 .862745 rg
+n 144 36 12 12 re f*
+.960784 .960784 .862745 rg
+n 156 36 12 12 re f*
+.960784 .960784 .862745 rg
+n 168 36 12 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 48 24 30 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 60 12 re f*
+n 84 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 96 24 24 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
+n 120 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 30 12 re f*
+n 126 24 24 12 re f*
.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
+n 150 24 6 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
+n 156 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
+n 162 24 12 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 6 12 re f*
+n 174 24 6 12 re f*
.960784 .960784 .862745 rg
-n 108 24.75 24 12 re f*
+n 186 24 12 12 re f*
.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
+n 198 24 6 12 re f*
.960784 .960784 .862745 rg
-n 144 24.75 12 12 re f*
+n 210 24 6 12 re f*
.960784 .960784 .862745 rg
-n 156 24.75 12 12 re f*
+n 222 24 6 12 re f*
.960784 .960784 .862745 rg
-n 168 24.75 12 12 re f*
+n 228 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 234 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
+n 246 24 12 12 re f*
.960784 .960784 .862745 rg
-n 84 12.75 54 12 re f*
+n 258 24 6 12 re f*
.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
+n 264 24 6 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 66 12 re f*
+n 270 24 12 12 re f*
.960784 .960784 .862745 rg
-n 216 12.75 12 12 re f*
+n 288 24 18 12 re f*
.960784 .960784 .862745 rg
-n 228 12.75 12 12 re f*
+n 312 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 12.75 12 12 re f*
+n 324 24 12 12 re f*
.960784 .960784 .862745 rg
-n 252 12.75 6 12 re f*
+n 342 24 36 12 re f*
.960784 .960784 .862745 rg
-n 264 12.75 6 12 re f*
+n 378 24 6 12 re f*
.960784 .960784 .862745 rg
-n 276 12.75 6 12 re f*
+n 384 24 12 12 re f*
.960784 .960784 .862745 rg
-n 282 12.75 6 12 re f*
+n 396 24 12 12 re f*
.960784 .960784 .862745 rg
-n 288 12.75 6 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 294 12.75 54 12 re f*
+n 48 12 30 12 re f*
.960784 .960784 .862745 rg
-n 348 12.75 6 12 re f*
+n 78 12 6 12 re f*
.960784 .960784 .862745 rg
-n 360 12.75 24 12 re f*
+n 84 12 48 12 re f*
.960784 .960784 .862745 rg
-n 384 12.75 6 12 re f*
+n 138 12 12 12 re f*
.960784 .960784 .862745 rg
-n 396 12.75 12 12 re f*
+n 150 12 60 12 re f*
.960784 .960784 .862745 rg
-n 408 12.75 6 12 re f*
+n 216 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 228 12 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
+n 246 12 12 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 6 12 re f*
+n 258 12 12 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 6 12 re f*
+n 276 12 6 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
+n 288 12 6 12 re f*
.960784 .960784 .862745 rg
-n 108 .75 24 12 re f*
+n 294 12 6 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 300 12 6 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 12 12 re f*
+n 306 12 48 12 re f*
.960784 .960784 .862745 rg
-n 156 .75 12 12 re f*
+n 354 12 6 12 re f*
.960784 .960784 .862745 rg
-n 168 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@decorator) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("calling ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (, ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func_name) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
+n 366 12 24 12 re f*
+.960784 .960784 .862745 rg
+n 390 12 6 12 re f*
+.960784 .960784 .862745 rg
+n 402 12 30 12 re f*
+.960784 .960784 .862745 rg
+n 432 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 18 12 re f*
+.960784 .960784 .862745 rg
+n 48 0 36 12 re f*
+.960784 .960784 .862745 rg
+n 90 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 96 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 102 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 108 0 24 12 re f*
+.960784 .960784 .862745 rg
+n 132 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 144 0 12 12 re f*
+.960784 .960784 .862745 rg
+n 156 0 12 12 re f*
+.960784 .960784 .862745 rg
+n 168 0 6 12 re f*
+BT 1 0 0 1 0 50 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@decorator) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (', ') Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (join) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg (') Tj /F5 10 Tf .733333 .4 .533333 rg (%r) Tj /F3 10 Tf .729412 .129412 .129412 rg (: ) Tj /F5 10 Tf .733333 .4 .533333 rg (%r) Tj /F3 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (k) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg ([) Tj 0 0 0 rg (k) Tj 0 0 0 rg (]\)) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (for) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (k) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (sorted) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("calling ) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (, {) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (}") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 173.2236 cm
+1 0 0 1 62.69291 492.8236 cm
q
-BT 1 0 0 1 0 14 Tm 1.806654 Tw 12 TL /F1 10 Tf 0 0 0 rg (and now ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (will be a decorator. Actually ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (is a ) Tj /F4 10 Tf 0 0 0 rg (partial ) Tj /F1 10 Tf 0 0 0 rg (object which can be used as a) Tj T* 0 Tw (decorator:) Tj T* ET
+BT 1 0 0 1 0 14 Tm 1.806654 Tw 12 TL /F1 10 Tf 0 0 0 rg (and now ) Tj /F3 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (will be a decorator. Actually ) Tj /F3 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (is a ) Tj /F3 10 Tf 0 0 0 rg (partial ) Tj /F1 10 Tf 0 0 0 rg (object which can be used as a) Tj T* 0 Tw (decorator:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 128.0236 cm
+1 0 0 1 62.69291 447.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -2635,51 +2994,44 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 48 12 re f*
+n 6 0 48 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 30 12 re f*
+n 60 0 30 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 12 12 re f*
+n 96 0 12 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
+n 114 0 6 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 18 12 re f*
+n 126 0 18 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (function) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (at) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (...) Tj (>) Tj T* ET
+n 144 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (function) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (at) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (...) Tj (>) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 108.0236 cm
+1 0 0 1 62.69291 427.6236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of usage:) Tj T* ET
Q
Q
-
-endstream
-endobj
-90 0 obj
-<< /Length 18247 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 691.8236 cm
+1 0 0 1 62.69291 346.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -2693,71 +3045,71 @@ n -6 -6 468.6898 72 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 36 12 re f*
+n 24 48 36 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 18 12 re f*
+n 24 36 18 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
+n 48 36 24 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 18 12 re f*
+n 72 36 18 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
+n 96 36 24 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 24 12 re f*
+n 24 12 24 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 12 12 re f*
+n 48 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
+n 0 0 42 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 24 12 re f*
+n 78 0 24 12 re f*
.960784 .960784 .862745 rg
-n 108 .75 24 12 re f*
+n 108 0 24 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
+n 138 0 18 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\(\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
+n 162 0 12 12 re f*
+BT 1 0 0 1 0 50 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (with) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\(\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 659.8236 cm
+1 0 0 1 62.69291 314.4236 cm
q
-BT 1 0 0 1 0 14 Tm 2.44686 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you are using an old Python version \(Python 2.4\) the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module provides a poor man) Tj T* 0 Tw (replacement for ) Tj /F4 10 Tf 0 0 0 rg (functools.partial) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
+BT 1 0 0 1 0 14 Tm 2.44686 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you are using an old Python version \(Python 2.4\) the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module provides a poor man) Tj T* 0 Tw (replacement for ) Tj /F3 10 Tf 0 0 0 rg (functools.partial) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 626.8236 cm
+1 0 0 1 62.69291 281.4236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (blocking) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 584.8236 cm
+1 0 0 1 62.69291 239.4236 cm
q
-BT 1 0 0 1 0 26 Tm 1.224692 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes one has to deal with blocking resources, such as ) Tj /F4 10 Tf 0 0 0 rg (stdin) Tj /F1 10 Tf 0 0 0 rg (, and sometimes it is best to have) Tj T* 0 Tw .266235 Tw (back a "busy" message than to block everything. This behavior can be implemented with a suitable family) Tj T* 0 Tw (of decorators, where the parameter is the busy message:) Tj T* ET
+BT 1 0 0 1 0 26 Tm 1.224692 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes one has to deal with blocking resources, such as ) Tj /F3 10 Tf 0 0 0 rg (stdin) Tj /F1 10 Tf 0 0 0 rg (, and sometimes it is best to have) Tj T* 0 Tw .266235 Tw (back a "busy" message than to block everything. This behavior can be implemented with a suitable family) Tj T* 0 Tw (of decorators, where the parameter is the busy message:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 395.6236 cm
+1 0 0 1 62.69291 86.22362 cm
q
q
1 0 0 1 0 0 cm
@@ -2767,193 +3119,220 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 180 re B*
+n -6 -6 468.6898 144 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 156.75 18 12 re f*
+n 0 120 18 12 re f*
.960784 .960784 .862745 rg
-n 24 156.75 48 12 re f*
+n 24 120 48 12 re f*
.960784 .960784 .862745 rg
-n 72 156.75 6 12 re f*
+n 72 120 6 12 re f*
.960784 .960784 .862745 rg
-n 78 156.75 54 12 re f*
+n 78 120 54 12 re f*
.960784 .960784 .862745 rg
-n 132 156.75 12 12 re f*
+n 132 120 12 12 re f*
.960784 .960784 .862745 rg
-n 24 144.75 18 12 re f*
+n 24 108 18 12 re f*
.960784 .960784 .862745 rg
-n 48 144.75 48 12 re f*
+n 48 108 48 12 re f*
.960784 .960784 .862745 rg
-n 96 144.75 6 12 re f*
+n 96 108 6 12 re f*
.960784 .960784 .862745 rg
-n 102 144.75 6 12 re f*
+n 102 108 6 12 re f*
.960784 .960784 .862745 rg
-n 108 144.75 6 12 re f*
+n 108 108 6 12 re f*
.960784 .960784 .862745 rg
-n 120 144.75 6 12 re f*
+n 120 108 6 12 re f*
.960784 .960784 .862745 rg
-n 126 144.75 24 12 re f*
+n 126 108 24 12 re f*
.960784 .960784 .862745 rg
-n 150 144.75 6 12 re f*
+n 150 108 6 12 re f*
.960784 .960784 .862745 rg
-n 162 144.75 12 12 re f*
+n 162 108 12 12 re f*
.960784 .960784 .862745 rg
-n 174 144.75 12 12 re f*
+n 174 108 12 12 re f*
.960784 .960784 .862745 rg
-n 186 144.75 12 12 re f*
+n 186 108 12 12 re f*
.960784 .960784 .862745 rg
-n 48 132.75 12 12 re f*
+n 48 96 12 12 re f*
.960784 .960784 .862745 rg
-n 66 132.75 18 12 re f*
+n 66 96 18 12 re f*
.960784 .960784 .862745 rg
-n 90 132.75 42 12 re f*
+n 90 96 42 12 re f*
.960784 .960784 .862745 rg
-n 132 132.75 6 12 re f*
+n 132 96 6 12 re f*
.960784 .960784 .862745 rg
-n 138 132.75 6 12 re f*
+n 138 96 6 12 re f*
.960784 .960784 .862745 rg
-n 144 132.75 6 12 re f*
+n 144 96 6 12 re f*
.960784 .960784 .862745 rg
-n 156 132.75 48 12 re f*
+n 156 96 48 12 re f*
.960784 .960784 .862745 rg
-n 204 132.75 12 12 re f*
+n 204 96 12 12 re f*
.960784 .960784 .862745 rg
-n 228 132.75 114 12 re f*
+n 228 96 114 12 re f*
.960784 .960784 .862745 rg
-n 72 120.75 18 12 re f*
+n 72 84 18 12 re f*
.960784 .960784 .862745 rg
-n 96 120.75 60 12 re f*
+n 96 84 60 12 re f*
.960784 .960784 .862745 rg
-n 156 120.75 18 12 re f*
+n 156 84 18 12 re f*
.960784 .960784 .862745 rg
-n 96 108.75 6 12 re f*
+n 96 72 6 12 re f*
.960784 .960784 .862745 rg
-n 102 108.75 6 12 re f*
+n 102 72 6 12 re f*
.960784 .960784 .862745 rg
-n 108 108.75 36 12 re f*
+n 108 72 36 12 re f*
.960784 .960784 .862745 rg
-n 150 108.75 6 12 re f*
+n 150 72 6 12 re f*
.960784 .960784 .862745 rg
-n 162 108.75 6 12 re f*
+n 162 72 6 12 re f*
.960784 .960784 .862745 rg
-n 168 108.75 6 12 re f*
+n 168 72 6 12 re f*
.960784 .960784 .862745 rg
-n 174 108.75 6 12 re f*
+n 174 72 6 12 re f*
.960784 .960784 .862745 rg
-n 180 108.75 24 12 re f*
+n 180 72 24 12 re f*
.960784 .960784 .862745 rg
-n 204 108.75 6 12 re f*
+n 204 72 6 12 re f*
.960784 .960784 .862745 rg
-n 216 108.75 12 12 re f*
+n 216 72 12 12 re f*
.960784 .960784 .862745 rg
-n 228 108.75 12 12 re f*
+n 228 72 12 12 re f*
.960784 .960784 .862745 rg
-n 240 108.75 6 12 re f*
+n 240 72 6 12 re f*
.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
+n 72 60 6 12 re f*
.960784 .960784 .862745 rg
-n 78 96.75 6 12 re f*
+n 78 60 6 12 re f*
.960784 .960784 .862745 rg
-n 84 96.75 36 12 re f*
+n 84 60 36 12 re f*
.960784 .960784 .862745 rg
-n 126 96.75 6 12 re f*
+n 126 60 6 12 re f*
.960784 .960784 .862745 rg
-n 138 96.75 54 12 re f*
+n 138 60 54 12 re f*
.960784 .960784 .862745 rg
-n 192 96.75 6 12 re f*
+n 192 60 6 12 re f*
.960784 .960784 .862745 rg
-n 198 96.75 36 12 re f*
+n 198 60 36 12 re f*
.960784 .960784 .862745 rg
-n 234 96.75 6 12 re f*
+n 234 60 6 12 re f*
.960784 .960784 .862745 rg
-n 240 96.75 24 12 re f*
+n 240 60 24 12 re f*
.960784 .960784 .862745 rg
-n 264 96.75 6 12 re f*
+n 264 60 6 12 re f*
.960784 .960784 .862745 rg
-n 276 96.75 60 12 re f*
+n 276 60 60 12 re f*
.960784 .960784 .862745 rg
-n 336 96.75 6 12 re f*
+n 336 60 6 12 re f*
.960784 .960784 .862745 rg
-n 72 84.75 6 12 re f*
+n 72 48 6 12 re f*
.960784 .960784 .862745 rg
-n 78 84.75 6 12 re f*
+n 78 48 6 12 re f*
.960784 .960784 .862745 rg
-n 84 84.75 36 12 re f*
+n 84 48 36 12 re f*
.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
+n 120 48 6 12 re f*
.960784 .960784 .862745 rg
-n 126 84.75 30 12 re f*
+n 126 48 30 12 re f*
.960784 .960784 .862745 rg
-n 156 84.75 12 12 re f*
+n 156 48 12 12 re f*
.960784 .960784 .862745 rg
-n 72 72.75 36 12 re f*
+n 72 36 36 12 re f*
.960784 .960784 .862745 rg
-n 114 72.75 54 12 re f*
+n 114 36 54 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 24 12 re f*
+n 48 24 24 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
+n 78 24 6 12 re f*
.960784 .960784 .862745 rg
-n 84 60.75 6 12 re f*
+n 84 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 36 12 re f*
+n 90 24 36 12 re f*
.960784 .960784 .862745 rg
-n 126 60.75 6 12 re f*
+n 126 24 6 12 re f*
.960784 .960784 .862745 rg
-n 132 60.75 42 12 re f*
+n 132 24 42 12 re f*
.960784 .960784 .862745 rg
-n 174 60.75 18 12 re f*
+n 174 24 18 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 36 12 re f*
+n 72 12 36 12 re f*
.960784 .960784 .862745 rg
-n 114 48.75 54 12 re f*
+n 114 12 54 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 72 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 90 0 282 12 re f*
+BT 1 0 0 1 0 122 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (not) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (hasattr) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("thread") Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# no thread running) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (set_result) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (set_result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (elif) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (isAlive) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the thread is ended, return the stored result) Tj /F3 10 Tf 0 0 0 rg T* ET
+Q
+Q
+Q
+Q
+Q
+
+endstream
+endobj
+102 0 obj
+<< /Length 13507 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
+q
+1 0 0 1 62.69291 715.8236 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
.960784 .960784 .862745 rg
-n 90 36.75 282 12 re f*
+n -6 -6 468.6898 48 re B*
+Q
+q
.960784 .960784 .862745 rg
-n 72 24.75 18 12 re f*
+n 72 24 18 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
+n 96 24 6 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 6 12 re f*
+n 102 24 6 12 re f*
.960784 .960784 .862745 rg
-n 108 24.75 36 12 re f*
+n 108 24 36 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 36 12 re f*
+n 72 12 36 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
+n 126 12 36 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
+n 66 0 54 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 48 12 re f*
+n 126 0 48 12 re f*
.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
-BT 1 0 0 1 0 158 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (not) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (hasattr) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("thread") Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# no thread running) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (set_result) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (set_result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (elif) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (isAlive) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the thread is ended, return the stored result) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (del) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (blocking) Tj 0 0 0 rg (\)) Tj T* ET
+n 174 0 6 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (del) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (blocking) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 363.6236 cm
+1 0 0 1 62.69291 683.8236 cm
q
-BT 1 0 0 1 0 14 Tm 1.010651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Functions decorated with ) Tj /F4 10 Tf 0 0 0 rg (blocking ) Tj /F1 10 Tf 0 0 0 rg (will return a busy message if the resource is unavailable, and the) Tj T* 0 Tw (intended result if the resource is available. For instance:) Tj T* ET
+BT 1 0 0 1 0 14 Tm 1.010651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Functions decorated with ) Tj /F3 10 Tf 0 0 0 rg (blocking ) Tj /F1 10 Tf 0 0 0 rg (will return a busy message if the resource is unavailable, and the) Tj T* 0 Tw (intended result if the resource is available. For instance:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 114.4236 cm
+1 0 0 1 62.69291 434.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -2967,215 +3346,216 @@ n -6 -6 468.6898 240 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 216.75 6 12 re f*
+n 0 216 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 216 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 216 6 12 re f*
.960784 .960784 .862745 rg
-n 6 216.75 6 12 re f*
+n 24 216 54 12 re f*
.960784 .960784 .862745 rg
-n 12 216.75 6 12 re f*
+n 78 216 6 12 re f*
.960784 .960784 .862745 rg
-n 24 216.75 54 12 re f*
+n 84 216 102 12 re f*
.960784 .960784 .862745 rg
-n 78 216.75 6 12 re f*
+n 186 216 6 12 re f*
.960784 .960784 .862745 rg
-n 84 216.75 102 12 re f*
+n 0 204 18 12 re f*
.960784 .960784 .862745 rg
-n 186 216.75 6 12 re f*
+n 24 204 18 12 re f*
.960784 .960784 .862745 rg
-n 0 204.75 18 12 re f*
+n 48 204 54 12 re f*
.960784 .960784 .862745 rg
-n 24 204.75 18 12 re f*
+n 102 204 18 12 re f*
.960784 .960784 .862745 rg
-n 48 204.75 54 12 re f*
+n 0 192 18 12 re f*
.960784 .960784 .862745 rg
-n 102 204.75 18 12 re f*
+n 48 192 24 12 re f*
.960784 .960784 .862745 rg
-n 0 192.75 18 12 re f*
+n 72 192 6 12 re f*
.960784 .960784 .862745 rg
-n 48 192.75 24 12 re f*
+n 78 192 30 12 re f*
.960784 .960784 .862745 rg
-n 72 192.75 6 12 re f*
+n 108 192 6 12 re f*
.960784 .960784 .862745 rg
-n 78 192.75 30 12 re f*
+n 114 192 6 12 re f*
.960784 .960784 .862745 rg
-n 108 192.75 6 12 re f*
+n 120 192 6 12 re f*
.960784 .960784 .862745 rg
-n 114 192.75 6 12 re f*
+n 132 192 180 12 re f*
.960784 .960784 .862745 rg
-n 120 192.75 6 12 re f*
+n 0 180 18 12 re f*
.960784 .960784 .862745 rg
-n 132 192.75 180 12 re f*
+n 48 180 36 12 re f*
.960784 .960784 .862745 rg
-n 0 180.75 18 12 re f*
+n 90 180 66 12 re f*
.960784 .960784 .862745 rg
-n 48 180.75 36 12 re f*
+n 0 156 6 12 re f*
.960784 .960784 .862745 rg
-n 90 180.75 66 12 re f*
+n 6 156 6 12 re f*
.960784 .960784 .862745 rg
-n 0 156.75 6 12 re f*
+n 12 156 6 12 re f*
.960784 .960784 .862745 rg
-n 6 156.75 6 12 re f*
+n 24 156 30 12 re f*
.960784 .960784 .862745 rg
-n 12 156.75 6 12 re f*
+n 54 156 6 12 re f*
.960784 .960784 .862745 rg
-n 24 156.75 30 12 re f*
+n 60 156 54 12 re f*
.960784 .960784 .862745 rg
-n 60 156.75 54 12 re f*
+n 114 156 18 12 re f*
.960784 .960784 .862745 rg
-n 114 156.75 12 12 re f*
+n 144 156 162 12 re f*
.960784 .960784 .862745 rg
-n 132 156.75 162 12 re f*
+n 0 144 36 12 re f*
.960784 .960784 .862745 rg
-n 0 144.75 36 12 re f*
+n 42 144 24 12 re f*
.960784 .960784 .862745 rg
-n 42 144.75 24 12 re f*
+n 72 144 18 12 re f*
.960784 .960784 .862745 rg
-n 72 144.75 18 12 re f*
+n 0 120 6 12 re f*
.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
+n 6 120 6 12 re f*
.960784 .960784 .862745 rg
-n 6 120.75 6 12 re f*
+n 12 120 6 12 re f*
.960784 .960784 .862745 rg
-n 12 120.75 6 12 re f*
+n 24 120 24 12 re f*
.960784 .960784 .862745 rg
-n 24 120.75 24 12 re f*
+n 48 120 6 12 re f*
.960784 .960784 .862745 rg
-n 48 120.75 6 12 re f*
+n 54 120 30 12 re f*
.960784 .960784 .862745 rg
-n 54 120.75 30 12 re f*
+n 84 120 6 12 re f*
.960784 .960784 .862745 rg
-n 84 120.75 6 12 re f*
+n 90 120 6 12 re f*
.960784 .960784 .862745 rg
-n 90 120.75 6 12 re f*
+n 96 120 6 12 re f*
.960784 .960784 .862745 rg
-n 96 120.75 6 12 re f*
+n 0 108 6 12 re f*
.960784 .960784 .862745 rg
-n 0 108.75 6 12 re f*
+n 6 108 6 12 re f*
.960784 .960784 .862745 rg
-n 6 108.75 6 12 re f*
+n 12 108 6 12 re f*
.960784 .960784 .862745 rg
-n 12 108.75 6 12 re f*
+n 24 108 30 12 re f*
.960784 .960784 .862745 rg
-n 24 108.75 30 12 re f*
+n 54 108 6 12 re f*
.960784 .960784 .862745 rg
-n 60 108.75 54 12 re f*
+n 60 108 54 12 re f*
.960784 .960784 .862745 rg
-n 114 108.75 12 12 re f*
+n 114 108 18 12 re f*
.960784 .960784 .862745 rg
-n 132 108.75 162 12 re f*
+n 144 108 162 12 re f*
.960784 .960784 .862745 rg
-n 0 96.75 36 12 re f*
+n 0 96 36 12 re f*
.960784 .960784 .862745 rg
-n 42 96.75 24 12 re f*
+n 42 96 24 12 re f*
.960784 .960784 .862745 rg
-n 72 96.75 18 12 re f*
+n 72 96 18 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
+n 0 72 6 12 re f*
.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
+n 6 72 6 12 re f*
.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
+n 12 72 6 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 24 12 re f*
+n 24 72 24 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
+n 48 72 6 12 re f*
.960784 .960784 .862745 rg
-n 54 72.75 30 12 re f*
+n 54 72 30 12 re f*
.960784 .960784 .862745 rg
-n 84 72.75 6 12 re f*
+n 84 72 6 12 re f*
.960784 .960784 .862745 rg
-n 90 72.75 6 12 re f*
+n 90 72 6 12 re f*
.960784 .960784 .862745 rg
-n 96 72.75 6 12 re f*
+n 96 72 6 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 0 60 6 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
+n 6 60 6 12 re f*
.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
+n 12 60 6 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 30 12 re f*
+n 24 60 30 12 re f*
.960784 .960784 .862745 rg
-n 60 60.75 54 12 re f*
+n 54 60 6 12 re f*
.960784 .960784 .862745 rg
-n 114 60.75 12 12 re f*
+n 60 60 54 12 re f*
.960784 .960784 .862745 rg
-n 132 60.75 162 12 re f*
+n 114 60 18 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 36 12 re f*
+n 144 60 162 12 re f*
.960784 .960784 .862745 rg
-n 42 48.75 24 12 re f*
+n 0 48 36 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 18 12 re f*
+n 42 48 24 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 72 48 18 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 24 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
+n 24 24 24 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 30 12 re f*
+n 48 24 6 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
+n 54 24 30 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 18 12 re f*
+n 84 24 6 12 re f*
.960784 .960784 .862745 rg
-n 108 24.75 6 12 re f*
+n 90 24 18 12 re f*
.960784 .960784 .862745 rg
-n 120 24.75 228 12 re f*
+n 108 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 126 24 228 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 12 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 24 12 re f*
+n 60 12 54 12 re f*
.960784 .960784 .862745 rg
-n 30 .75 24 12 re f*
-BT 1 0 0 1 0 218 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@blocking) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("Please wait ...") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (read_data) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate a blocking resource) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("some data") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1.1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# after 3.1 seconds, data is available) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (some) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (data) Tj T* ET
+n 114 12 18 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 24 12 re f*
+.960784 .960784 .862745 rg
+n 30 0 24 12 re f*
+BT 1 0 0 1 0 218 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@blocking) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("Please wait ...") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (read_data) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate a blocking resource) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("some data") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F3 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F3 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F3 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1.1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# after 3.1 seconds, data is available) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* 0 0 0 rg (some) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (data) Tj T* ET
Q
Q
Q
Q
Q
-
-endstream
-endobj
-91 0 obj
-<< /Length 16586 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 744.0236 cm
+1 0 0 1 62.69291 401.6236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (async) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 702.0236 cm
+1 0 0 1 62.69291 359.6236 cm
q
0 0 0 rg
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 1.647485 Tw (We have just seen an examples of a simple decorator factory, implemented as a function returning a) Tj T* 0 Tw .29784 Tw (decorator. For more complex situations, it is more convenient to implement decorator factories as classes) Tj T* 0 Tw (returning callable objects that can be converted into decorators.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 636.0236 cm
+1 0 0 1 62.69291 293.6236 cm
q
-BT 1 0 0 1 0 50 Tm 2.853876 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an example, here will I show a decorator which is able to convert a blocking function into an) Tj T* 0 Tw 2.477126 Tw (asynchronous function. The function, when called, is executed in a separate thread. Moreover, it is) Tj T* 0 Tw .288443 Tw (possible to set three callbacks ) Tj /F4 10 Tf 0 0 0 rg (on_success) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (on_failure ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (on_closing) Tj /F1 10 Tf 0 0 0 rg (, to specify how to manage) Tj T* 0 Tw 1.854724 Tw (the function call \(of course the code here is just an example, it is not a recommended way of doing) Tj T* 0 Tw (multi-threaded programming\). The implementation is the following:) Tj T* ET
+BT 1 0 0 1 0 50 Tm 2.853876 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an example, here will I show a decorator which is able to convert a blocking function into an) Tj T* 0 Tw 2.477126 Tw (asynchronous function. The function, when called, is executed in a separate thread. Moreover, it is) Tj T* 0 Tw .288443 Tw (possible to set three callbacks ) Tj /F3 10 Tf 0 0 0 rg (on_success) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (on_failure ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (on_closing) Tj /F1 10 Tf 0 0 0 rg (, to specify how to manage) Tj T* 0 Tw 1.854724 Tw (the function call \(of course the code here is just an example, it is not a recommended way of doing) Tj T* 0 Tw (multi-threaded programming\). The implementation is the following:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 578.8236 cm
+1 0 0 1 62.69291 236.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -3189,31 +3569,31 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
+n 24 24 60 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
+n 84 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 36 12 re f*
+n 90 24 36 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 12 12 re f*
+n 126 24 12 12 re f*
.960784 .960784 .862745 rg
-n 150 24.75 144 12 re f*
+n 150 24 144 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 228 12 re f*
+n 24 12 228 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 36 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called on the result of the function") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
+n 66 0 36 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called on the result of the function") Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 521.6236 cm
+1 0 0 1 62.69291 179.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -3227,29 +3607,29 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
+n 24 24 60 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
+n 84 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 48 12 re f*
+n 90 24 48 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
+n 138 24 12 12 re f*
.960784 .960784 .862745 rg
-n 162 24.75 144 12 re f*
+n 162 24 144 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 180 12 re f*
+n 24 12 180 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called if the function fails") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
+n 24 0 24 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called if the function fails") Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 464.4236 cm
+1 0 0 1 62.69291 122.0236 cm
q
q
1 0 0 1 0 0 cm
@@ -3263,25 +3643,32 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
+n 24 24 60 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 18 12 re f*
+n 84 24 18 12 re f*
.960784 .960784 .862745 rg
-n 114 24.75 144 12 re f*
+n 114 24 144 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 336 12 re f*
+n 24 12 336 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_closing) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called at the end, both in case of success and failure") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
+n 24 0 24 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_closing) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called at the end, both in case of success and failure") Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj T* ET
Q
Q
Q
Q
Q
+
+endstream
+endobj
+103 0 obj
+<< /Length 19219 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 83.22362 cm
+1 0 0 1 62.69291 331.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -3291,381 +3678,354 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 372 re B*
+n -6 -6 468.6898 432 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 348.75 30 12 re f*
+n 0 408 30 12 re f*
.960784 .960784 .862745 rg
-n 36 348.75 30 12 re f*
+n 36 408 30 12 re f*
.960784 .960784 .862745 rg
-n 66 348.75 6 12 re f*
+n 66 408 6 12 re f*
.960784 .960784 .862745 rg
-n 72 348.75 36 12 re f*
+n 72 408 36 12 re f*
.960784 .960784 .862745 rg
-n 108 348.75 12 12 re f*
+n 108 408 12 12 re f*
.960784 .960784 .862745 rg
-n 24 336.75 18 12 re f*
+n 24 396 18 12 re f*
.960784 .960784 .862745 rg
-n 0 324.75 378 12 re f*
+n 0 384 378 12 re f*
.960784 .960784 .862745 rg
-n 0 312.75 330 12 re f*
+n 0 372 330 12 re f*
.960784 .960784 .862745 rg
-n 0 300.75 0 12 re f*
+n 0 360 0 12 re f*
.960784 .960784 .862745 rg
-n 0 288.75 294 12 re f*
+n 0 348 294 12 re f*
.960784 .960784 .862745 rg
-n 0 276.75 348 12 re f*
+n 0 336 348 12 re f*
.960784 .960784 .862745 rg
-n 0 264.75 42 12 re f*
+n 0 324 42 12 re f*
.960784 .960784 .862745 rg
-n 24 240.75 18 12 re f*
+n 24 300 18 12 re f*
.960784 .960784 .862745 rg
-n 48 240.75 48 12 re f*
+n 48 300 48 12 re f*
.960784 .960784 .862745 rg
-n 96 240.75 6 12 re f*
+n 96 300 6 12 re f*
.960784 .960784 .862745 rg
-n 102 240.75 24 12 re f*
+n 102 300 24 12 re f*
.960784 .960784 .862745 rg
-n 126 240.75 6 12 re f*
+n 126 300 6 12 re f*
.960784 .960784 .862745 rg
-n 138 240.75 78 12 re f*
+n 138 300 78 12 re f*
.960784 .960784 .862745 rg
-n 216 240.75 6 12 re f*
+n 216 300 6 12 re f*
.960784 .960784 .862745 rg
-n 228 240.75 60 12 re f*
+n 228 300 60 12 re f*
.960784 .960784 .862745 rg
-n 288 240.75 6 12 re f*
+n 288 300 6 12 re f*
.960784 .960784 .862745 rg
-n 294 240.75 60 12 re f*
+n 294 300 60 12 re f*
.960784 .960784 .862745 rg
-n 354 240.75 6 12 re f*
+n 354 300 6 12 re f*
.960784 .960784 .862745 rg
-n 102 228.75 60 12 re f*
+n 102 288 60 12 re f*
.960784 .960784 .862745 rg
-n 162 228.75 6 12 re f*
+n 162 288 6 12 re f*
.960784 .960784 .862745 rg
-n 168 228.75 60 12 re f*
+n 168 288 60 12 re f*
.960784 .960784 .862745 rg
-n 228 228.75 6 12 re f*
+n 228 288 6 12 re f*
.960784 .960784 .862745 rg
-n 240 228.75 60 12 re f*
+n 240 288 60 12 re f*
.960784 .960784 .862745 rg
-n 300 228.75 6 12 re f*
+n 300 288 6 12 re f*
.960784 .960784 .862745 rg
-n 306 228.75 60 12 re f*
+n 306 288 60 12 re f*
.960784 .960784 .862745 rg
-n 366 228.75 12 12 re f*
+n 366 288 12 12 re f*
.960784 .960784 .862745 rg
-n 48 216.75 24 12 re f*
+n 48 276 24 12 re f*
.960784 .960784 .862745 rg
-n 72 216.75 6 12 re f*
+n 72 276 6 12 re f*
.960784 .960784 .862745 rg
-n 78 216.75 78 12 re f*
+n 78 276 78 12 re f*
.960784 .960784 .862745 rg
-n 162 216.75 6 12 re f*
+n 162 276 6 12 re f*
.960784 .960784 .862745 rg
-n 174 216.75 78 12 re f*
+n 174 276 78 12 re f*
.960784 .960784 .862745 rg
-n 48 204.75 24 12 re f*
+n 48 264 24 12 re f*
.960784 .960784 .862745 rg
-n 72 204.75 6 12 re f*
+n 72 264 6 12 re f*
.960784 .960784 .862745 rg
-n 78 204.75 60 12 re f*
+n 78 264 60 12 re f*
.960784 .960784 .862745 rg
-n 144 204.75 6 12 re f*
+n 144 264 6 12 re f*
.960784 .960784 .862745 rg
-n 156 204.75 60 12 re f*
+n 156 264 60 12 re f*
.960784 .960784 .862745 rg
-n 48 192.75 24 12 re f*
+n 48 252 24 12 re f*
.960784 .960784 .862745 rg
-n 72 192.75 6 12 re f*
+n 72 252 6 12 re f*
.960784 .960784 .862745 rg
-n 78 192.75 60 12 re f*
+n 78 252 60 12 re f*
.960784 .960784 .862745 rg
-n 144 192.75 6 12 re f*
+n 144 252 6 12 re f*
.960784 .960784 .862745 rg
-n 156 192.75 60 12 re f*
+n 156 252 60 12 re f*
.960784 .960784 .862745 rg
-n 48 180.75 24 12 re f*
+n 48 240 24 12 re f*
.960784 .960784 .862745 rg
-n 72 180.75 6 12 re f*
+n 72 240 6 12 re f*
.960784 .960784 .862745 rg
-n 78 180.75 60 12 re f*
+n 78 240 60 12 re f*
.960784 .960784 .862745 rg
-n 144 180.75 6 12 re f*
+n 144 240 6 12 re f*
.960784 .960784 .862745 rg
-n 156 180.75 60 12 re f*
+n 156 240 60 12 re f*
.960784 .960784 .862745 rg
-n 24 156.75 18 12 re f*
+n 24 216 18 12 re f*
.960784 .960784 .862745 rg
-n 48 156.75 48 12 re f*
+n 48 216 48 12 re f*
.960784 .960784 .862745 rg
-n 96 156.75 6 12 re f*
+n 96 216 6 12 re f*
.960784 .960784 .862745 rg
-n 102 156.75 24 12 re f*
+n 102 216 24 12 re f*
.960784 .960784 .862745 rg
-n 126 156.75 6 12 re f*
+n 126 216 6 12 re f*
.960784 .960784 .862745 rg
-n 138 156.75 24 12 re f*
+n 138 216 24 12 re f*
.960784 .960784 .862745 rg
-n 162 156.75 6 12 re f*
+n 162 216 6 12 re f*
.960784 .960784 .862745 rg
-n 174 156.75 6 12 re f*
+n 174 216 6 12 re f*
.960784 .960784 .862745 rg
-n 180 156.75 24 12 re f*
+n 180 216 24 12 re f*
.960784 .960784 .862745 rg
-n 204 156.75 6 12 re f*
+n 204 216 6 12 re f*
.960784 .960784 .862745 rg
-n 216 156.75 12 12 re f*
+n 216 216 12 12 re f*
.960784 .960784 .862745 rg
-n 228 156.75 12 12 re f*
+n 228 216 12 12 re f*
.960784 .960784 .862745 rg
-n 240 156.75 12 12 re f*
+n 240 216 12 12 re f*
.960784 .960784 .862745 rg
-n 48 144.75 18 12 re f*
+n 48 204 18 12 re f*
.960784 .960784 .862745 rg
-n 66 144.75 6 12 re f*
+n 66 204 6 12 re f*
.960784 .960784 .862745 rg
-n 72 132.75 42 12 re f*
+n 72 192 42 12 re f*
.960784 .960784 .862745 rg
-n 120 132.75 6 12 re f*
+n 120 192 6 12 re f*
.960784 .960784 .862745 rg
-n 132 132.75 24 12 re f*
+n 132 192 24 12 re f*
.960784 .960784 .862745 rg
-n 156 132.75 6 12 re f*
+n 156 192 6 12 re f*
.960784 .960784 .862745 rg
-n 162 132.75 42 12 re f*
+n 162 192 42 12 re f*
.960784 .960784 .862745 rg
-n 48 120.75 36 12 re f*
+n 48 180 36 12 re f*
.960784 .960784 .862745 rg
-n 90 120.75 84 12 re f*
+n 90 180 84 12 re f*
.960784 .960784 .862745 rg
-n 174 120.75 6 12 re f*
+n 174 180 6 12 re f*
.960784 .960784 .862745 rg
-n 192 120.75 258 12 re f*
+n 192 180 258 12 re f*
.960784 .960784 .862745 rg
-n 72 108.75 42 12 re f*
+n 72 168 42 12 re f*
.960784 .960784 .862745 rg
-n 120 108.75 6 12 re f*
+n 120 168 6 12 re f*
.960784 .960784 .862745 rg
-n 132 108.75 24 12 re f*
+n 132 168 24 12 re f*
.960784 .960784 .862745 rg
-n 156 108.75 6 12 re f*
+n 156 168 6 12 re f*
.960784 .960784 .862745 rg
-n 162 108.75 42 12 re f*
+n 162 168 42 12 re f*
.960784 .960784 .862745 rg
-n 210 108.75 6 12 re f*
+n 210 168 6 12 re f*
.960784 .960784 .862745 rg
-n 222 108.75 54 12 re f*
+n 222 168 54 12 re f*
.960784 .960784 .862745 rg
-n 276 108.75 6 12 re f*
+n 276 168 6 12 re f*
.960784 .960784 .862745 rg
-n 282 108.75 30 12 re f*
+n 282 168 30 12 re f*
.960784 .960784 .862745 rg
-n 312 108.75 6 12 re f*
+n 312 168 6 12 re f*
.960784 .960784 .862745 rg
-n 318 108.75 6 12 re f*
+n 318 168 6 12 re f*
.960784 .960784 .862745 rg
-n 324 108.75 6 12 re f*
+n 324 168 6 12 re f*
.960784 .960784 .862745 rg
-n 48 96.75 24 12 re f*
+n 48 156 24 12 re f*
.960784 .960784 .862745 rg
-n 78 96.75 6 12 re f*
+n 78 156 6 12 re f*
.960784 .960784 .862745 rg
-n 90 96.75 6 12 re f*
+n 90 156 6 12 re f*
.960784 .960784 .862745 rg
-n 96 96.75 12 12 re f*
+n 96 156 12 12 re f*
.960784 .960784 .862745 rg
-n 108 96.75 6 12 re f*
+n 108 156 6 12 re f*
.960784 .960784 .862745 rg
-n 114 96.75 12 12 re f*
+n 114 156 12 12 re f*
.960784 .960784 .862745 rg
-n 126 96.75 6 12 re f*
+n 126 156 6 12 re f*
.960784 .960784 .862745 rg
-n 138 96.75 6 12 re f*
+n 138 156 6 12 re f*
.960784 .960784 .862745 rg
-n 150 96.75 6 12 re f*
+n 150 156 6 12 re f*
.960784 .960784 .862745 rg
-n 156 96.75 24 12 re f*
+n 156 156 24 12 re f*
.960784 .960784 .862745 rg
-n 180 96.75 6 12 re f*
+n 180 156 6 12 re f*
.960784 .960784 .862745 rg
-n 186 96.75 48 12 re f*
+n 186 156 48 12 re f*
.960784 .960784 .862745 rg
-n 234 96.75 6 12 re f*
+n 234 156 6 12 re f*
.960784 .960784 .862745 rg
-n 246 96.75 42 12 re f*
+n 246 156 24 12 re f*
.960784 .960784 .862745 rg
-n 288 96.75 6 12 re f*
+n 270 156 6 12 re f*
.960784 .960784 .862745 rg
-n 294 96.75 24 12 re f*
+n 276 156 42 12 re f*
.960784 .960784 .862745 rg
-n 318 96.75 18 12 re f*
+n 318 156 12 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 18 12 re f*
+n 48 132 18 12 re f*
.960784 .960784 .862745 rg
-n 72 72.75 72 12 re f*
+n 72 132 72 12 re f*
.960784 .960784 .862745 rg
-n 144 72.75 18 12 re f*
+n 144 132 18 12 re f*
.960784 .960784 .862745 rg
-n 72 60.75 18 12 re f*
+n 72 120 18 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
+n 90 120 6 12 re f*
.960784 .960784 .862745 rg
-n 96 48.75 36 12 re f*
+n 96 108 36 12 re f*
.960784 .960784 .862745 rg
-n 138 48.75 6 12 re f*
+n 138 108 6 12 re f*
.960784 .960784 .862745 rg
-n 150 48.75 24 12 re f*
+n 150 108 24 12 re f*
.960784 .960784 .862745 rg
-n 174 48.75 6 12 re f*
+n 174 108 6 12 re f*
.960784 .960784 .862745 rg
-n 180 48.75 6 12 re f*
+n 180 108 6 12 re f*
.960784 .960784 .862745 rg
-n 186 48.75 24 12 re f*
+n 186 108 24 12 re f*
.960784 .960784 .862745 rg
-n 210 48.75 6 12 re f*
+n 210 108 6 12 re f*
.960784 .960784 .862745 rg
-n 222 48.75 12 12 re f*
+n 222 108 12 12 re f*
.960784 .960784 .862745 rg
-n 234 48.75 12 12 re f*
+n 234 108 12 12 re f*
.960784 .960784 .862745 rg
-n 246 48.75 6 12 re f*
+n 246 108 6 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 36 12 re f*
+n 72 96 36 12 re f*
.960784 .960784 .862745 rg
-n 108 36.75 6 12 re f*
+n 108 96 6 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 24 12 re f*
+n 96 84 24 12 re f*
.960784 .960784 .862745 rg
-n 120 24.75 6 12 re f*
+n 120 84 6 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 60 12 re f*
+n 126 84 60 12 re f*
.960784 .960784 .862745 rg
-n 186 24.75 6 12 re f*
+n 186 84 6 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 18 12 re f*
+n 192 84 18 12 re f*
.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
+n 210 84 6 12 re f*
.960784 .960784 .862745 rg
-n 216 24.75 48 12 re f*
+n 216 84 48 12 re f*
.960784 .960784 .862745 rg
-n 264 24.75 18 12 re f*
+n 264 84 18 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 24 12 re f*
+n 72 72 24 12 re f*
.960784 .960784 .862745 rg
-n 96 12.75 6 12 re f*
+n 96 72 6 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 36 12 re f*
+n 96 60 36 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 24 12 re f*
+n 138 60 24 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
+n 162 60 6 12 re f*
.960784 .960784 .862745 rg
-n 168 .75 60 12 re f*
+n 168 60 60 12 re f*
.960784 .960784 .862745 rg
-n 228 .75 6 12 re f*
+n 228 60 6 12 re f*
.960784 .960784 .862745 rg
-n 234 .75 36 12 re f*
+n 234 60 36 12 re f*
.960784 .960784 .862745 rg
-n 270 .75 6 12 re f*
-BT 1 0 0 1 0 350 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (Async) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( A decorator converting blocking functions into asynchronous) Tj T* ( functions, by using threads or processes. Examples:) Tj T* T* ( async_with_threads = Async\(threading.Thread\)) Tj T* ( async_with_processes = Async\(multiprocessing.Process\)) Tj T* ( """) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (on_failure) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (except) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf .823529 .254902 .227451 rg (AttributeError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# instantiate the counter at the first call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (itertools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (count) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (') Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (-) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (counter) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (next) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func_wrapper) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (except) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (sys) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-92 0 obj
-<< /Length 17364 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 691.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
+n 270 60 6 12 re f*
.960784 .960784 .862745 rg
-n -6 -6 468.6898 72 re B*
-Q
-q
+n 72 48 42 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 42 12 re f*
+n 114 48 6 12 re f*
.960784 .960784 .862745 rg
-n 114 48.75 6 12 re f*
+n 96 36 24 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
+n 120 36 6 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
+n 126 36 60 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 60 12 re f*
+n 186 36 12 12 re f*
.960784 .960784 .862745 rg
-n 186 36.75 12 12 re f*
+n 48 24 36 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 36 12 re f*
+n 90 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
+n 102 24 24 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
+n 126 24 6 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
+n 132 24 78 12 re f*
.960784 .960784 .862745 rg
-n 132 24.75 78 12 re f*
+n 210 24 6 12 re f*
.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
+n 216 24 24 12 re f*
.960784 .960784 .862745 rg
-n 216 24.75 24 12 re f*
+n 240 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 24.75 6 12 re f*
+n 252 24 72 12 re f*
.960784 .960784 .862745 rg
-n 252 24.75 72 12 re f*
+n 324 24 6 12 re f*
.960784 .960784 .862745 rg
-n 324 24.75 6 12 re f*
+n 336 24 24 12 re f*
.960784 .960784 .862745 rg
-n 336 24.75 24 12 re f*
+n 360 24 6 12 re f*
.960784 .960784 .862745 rg
-n 360 24.75 6 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
+n 84 12 6 12 re f*
.960784 .960784 .862745 rg
-n 84 12.75 6 12 re f*
+n 90 12 30 12 re f*
.960784 .960784 .862745 rg
-n 90 12.75 30 12 re f*
+n 120 12 12 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 12 12 re f*
+n 48 0 36 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 36 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (finally) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func_wrapper) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (thread) Tj T* ET
+n 90 0 36 12 re f*
+BT 1 0 0 1 0 410 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (class) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (Async) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( A decorator converting blocking functions into asynchronous) Tj T* ( functions, by using threads or processes. Examples:) Tj T* T* ( async_with_threads = Async\(threading.Thread\)) Tj T* ( async_with_processes = Async\(multiprocessing.Process\)) Tj T* ( """) Tj /F3 10 Tf 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (on_failure) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (try) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (except) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf .823529 .254902 .227451 rg (AttributeError) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# instantiate the counter at the first call) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (itertools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (count) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (') Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (-) Tj /F5 10 Tf .733333 .4 .533333 rg (%s) Tj /F3 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (next) Tj 0 0 0 rg (\() Tj 0 0 0 rg (counter) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func_wrapper) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (try) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (except) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (sys) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (finally) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func_wrapper) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (thread) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 659.8236 cm
+1 0 0 1 62.69291 299.8236 cm
q
-BT 1 0 0 1 0 14 Tm .865984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The decorated function returns the current execution thread, which can be stored and checked later, for) Tj T* 0 Tw (instance to verify that the thread ) Tj /F4 10 Tf 0 0 0 rg (.isAlive\(\)) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
+BT 1 0 0 1 0 14 Tm .865984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The decorated function returns the current execution thread, which can be stored and checked later, for) Tj T* 0 Tw (instance to verify that the thread ) Tj /F3 10 Tf 0 0 0 rg (.isAlive\(\)) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 617.8236 cm
+1 0 0 1 62.69291 257.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL .691654 Tw (Here is an example of usage. Suppose one wants to write some data to an external resource which can) Tj T* 0 Tw .21683 Tw (be accessed by a single user at once \(for instance a printer\). Then the access to the writing function must) Tj T* 0 Tw (be locked. Here is a minimalistic example:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 464.6236 cm
+1 0 0 1 62.69291 104.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -3679,129 +4039,136 @@ n -6 -6 468.6898 144 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
+n 0 120 6 12 re f*
.960784 .960784 .862745 rg
-n 6 120.75 6 12 re f*
+n 6 120 6 12 re f*
.960784 .960784 .862745 rg
-n 12 120.75 6 12 re f*
+n 12 120 6 12 re f*
.960784 .960784 .862745 rg
-n 24 120.75 30 12 re f*
+n 24 120 30 12 re f*
.960784 .960784 .862745 rg
-n 60 120.75 6 12 re f*
+n 60 120 6 12 re f*
.960784 .960784 .862745 rg
-n 72 120.75 54 12 re f*
+n 72 120 54 12 re f*
.960784 .960784 .862745 rg
-n 126 120.75 6 12 re f*
+n 126 120 6 12 re f*
.960784 .960784 .862745 rg
-n 132 120.75 30 12 re f*
+n 132 120 30 12 re f*
.960784 .960784 .862745 rg
-n 162 120.75 6 12 re f*
+n 162 120 6 12 re f*
.960784 .960784 .862745 rg
-n 168 120.75 54 12 re f*
+n 168 120 54 12 re f*
.960784 .960784 .862745 rg
-n 222 120.75 6 12 re f*
+n 222 120 6 12 re f*
.960784 .960784 .862745 rg
-n 228 120.75 36 12 re f*
+n 228 120 36 12 re f*
.960784 .960784 .862745 rg
-n 264 120.75 12 12 re f*
+n 264 120 12 12 re f*
.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
+n 0 96 6 12 re f*
.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
+n 6 96 6 12 re f*
.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
+n 12 96 6 12 re f*
.960784 .960784 .862745 rg
-n 24 96.75 48 12 re f*
+n 24 96 48 12 re f*
.960784 .960784 .862745 rg
-n 78 96.75 6 12 re f*
+n 78 96 6 12 re f*
.960784 .960784 .862745 rg
-n 90 96.75 12 12 re f*
+n 90 96 12 12 re f*
.960784 .960784 .862745 rg
-n 108 96.75 342 12 re f*
+n 108 96 342 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
+n 0 72 6 12 re f*
.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
+n 6 72 6 12 re f*
.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
+n 12 72 6 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 36 12 re f*
+n 24 72 36 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
+n 0 60 18 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 18 12 re f*
+n 24 60 18 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
+n 48 60 30 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
+n 78 60 6 12 re f*
.960784 .960784 .862745 rg
-n 84 60.75 24 12 re f*
+n 84 60 24 12 re f*
.960784 .960784 .862745 rg
-n 108 60.75 12 12 re f*
+n 108 60 12 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 0 48 18 12 re f*
.960784 .960784 .862745 rg
-n 48 48.75 240 12 re f*
+n 48 48 240 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
+n 48 36 24 12 re f*
.960784 .960784 .862745 rg
-n 78 36.75 54 12 re f*
+n 78 36 54 12 re f*
.960784 .960784 .862745 rg
-n 132 36.75 6 12 re f*
+n 132 36 6 12 re f*
.960784 .960784 .862745 rg
-n 138 36.75 24 12 re f*
+n 138 36 24 12 re f*
.960784 .960784 .862745 rg
-n 162 36.75 18 12 re f*
+n 162 36 18 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 24 12 re f*
+n 72 24 24 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
+n 96 24 6 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 30 12 re f*
+n 102 24 30 12 re f*
.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
+n 132 24 6 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 6 12 re f*
+n 138 24 6 12 re f*
.960784 .960784 .862745 rg
-n 144 24.75 6 12 re f*
+n 144 24 6 12 re f*
.960784 .960784 .862745 rg
-n 156 24.75 222 12 re f*
+n 156 24 222 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 48 12 re f*
+n 72 12 48 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
+n 126 12 36 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 6 12 re f*
+n 162 12 6 12 re f*
.960784 .960784 .862745 rg
-n 168 12.75 24 12 re f*
+n 168 12 24 12 re f*
.960784 .960784 .862745 rg
-n 192 12.75 6 12 re f*
+n 192 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 264 12 re f*
-BT 1 0 0 1 0 122 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (async) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (Async) Tj 0 0 0 rg (\() Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ([]) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# for simplicity the written data are stored into a list.) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@async) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (write) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# append data to the datalist by locking) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Lock) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# emulate some long running operation) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (append) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# other operations not requiring a lock here) Tj T* ET
+n 48 0 264 12 re f*
+BT 1 0 0 1 0 122 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (async) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (Async) Tj 0 0 0 rg (\() Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ([]) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# for simplicity the written data are stored into a list.) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@async) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (write) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# append data to the datalist by locking) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (with) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Lock) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# emulate some long running operation) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (append) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# other operations not requiring a lock here) Tj T* ET
Q
Q
Q
Q
Q
+
+endstream
+endobj
+104 0 obj
+<< /Length 14591 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 432.6236 cm
+1 0 0 1 62.69291 741.0236 cm
q
-BT 1 0 0 1 0 14 Tm .905868 Tw 12 TL /F1 10 Tf 0 0 0 rg (Each call to ) Tj /F4 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (will create a new writer thread, but there will be no synchronization problems since) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (is locked.) Tj T* ET
+BT 1 0 0 1 0 14 Tm .905868 Tw 12 TL /F1 10 Tf 0 0 0 rg (Each call to ) Tj /F3 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (will create a new writer thread, but there will be no synchronization problems since) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (is locked.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 267.4236 cm
+1 0 0 1 62.69291 575.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -3815,159 +4182,163 @@ n -6 -6 468.6898 156 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 132.75 6 12 re f*
+n 0 132 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 132 6 12 re f*
+.960784 .960784 .862745 rg
+n 12 132 6 12 re f*
.960784 .960784 .862745 rg
-n 6 132.75 6 12 re f*
+n 24 132 30 12 re f*
.960784 .960784 .862745 rg
-n 12 132.75 6 12 re f*
+n 54 132 6 12 re f*
.960784 .960784 .862745 rg
-n 24 132.75 30 12 re f*
+n 60 132 42 12 re f*
.960784 .960784 .862745 rg
-n 54 132.75 6 12 re f*
+n 102 132 6 12 re f*
.960784 .960784 .862745 rg
-n 60 132.75 42 12 re f*
+n 0 120 6 12 re f*
.960784 .960784 .862745 rg
-n 102 132.75 6 12 re f*
+n 6 120 36 12 re f*
.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
+n 42 120 6 12 re f*
.960784 .960784 .862745 rg
-n 6 120.75 36 12 re f*
+n 48 120 30 12 re f*
.960784 .960784 .862745 rg
-n 42 120.75 6 12 re f*
+n 78 120 6 12 re f*
.960784 .960784 .862745 rg
-n 48 120.75 30 12 re f*
+n 84 120 6 12 re f*
.960784 .960784 .862745 rg
-n 78 120.75 6 12 re f*
+n 90 120 6 12 re f*
.960784 .960784 .862745 rg
-n 84 120.75 6 12 re f*
+n 102 120 42 12 re f*
.960784 .960784 .862745 rg
-n 90 120.75 6 12 re f*
+n 144 120 18 12 re f*
.960784 .960784 .862745 rg
-n 102 120.75 42 12 re f*
+n 162 120 6 12 re f*
.960784 .960784 .862745 rg
-n 144 120.75 18 12 re f*
+n 168 120 6 12 re f*
.960784 .960784 .862745 rg
-n 162 120.75 6 12 re f*
+n 0 96 6 12 re f*
.960784 .960784 .862745 rg
-n 168 120.75 6 12 re f*
+n 6 96 6 12 re f*
.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
+n 12 96 6 12 re f*
.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
+n 24 96 24 12 re f*
.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
+n 48 96 6 12 re f*
.960784 .960784 .862745 rg
-n 24 96.75 24 12 re f*
+n 54 96 30 12 re f*
.960784 .960784 .862745 rg
-n 48 96.75 6 12 re f*
+n 84 96 6 12 re f*
.960784 .960784 .862745 rg
-n 54 96.75 30 12 re f*
+n 90 96 6 12 re f*
.960784 .960784 .862745 rg
-n 84 96.75 6 12 re f*
+n 96 96 6 12 re f*
.960784 .960784 .862745 rg
-n 90 96.75 6 12 re f*
+n 102 96 6 12 re f*
.960784 .960784 .862745 rg
-n 96 96.75 6 12 re f*
+n 114 96 342 12 re f*
.960784 .960784 .862745 rg
-n 102 96.75 6 12 re f*
+n 0 72 6 12 re f*
.960784 .960784 .862745 rg
-n 114 96.75 342 12 re f*
+n 6 72 6 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
+n 12 72 6 12 re f*
.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
+n 24 72 30 12 re f*
.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
+n 54 72 6 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 30 12 re f*
+n 60 72 42 12 re f*
.960784 .960784 .862745 rg
-n 54 72.75 6 12 re f*
+n 102 72 6 12 re f*
.960784 .960784 .862745 rg
-n 60 72.75 42 12 re f*
+n 0 60 6 12 re f*
.960784 .960784 .862745 rg
-n 102 72.75 6 12 re f*
+n 6 60 36 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 42 60 6 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 36 12 re f*
+n 48 60 30 12 re f*
.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
+n 78 60 6 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
+n 84 60 6 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
+n 90 60 6 12 re f*
.960784 .960784 .862745 rg
-n 84 60.75 6 12 re f*
+n 102 60 42 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
+n 144 60 18 12 re f*
.960784 .960784 .862745 rg
-n 102 60.75 42 12 re f*
+n 162 60 6 12 re f*
.960784 .960784 .862745 rg
-n 144 60.75 18 12 re f*
+n 168 60 6 12 re f*
.960784 .960784 .862745 rg
-n 162 60.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 168 60.75 6 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 24 36 24 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 48 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 24 12 re f*
+n 54 36 30 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
+n 84 36 6 12 re f*
.960784 .960784 .862745 rg
-n 54 36.75 30 12 re f*
+n 90 36 6 12 re f*
.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
+n 96 36 6 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 6 12 re f*
+n 108 36 204 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 108 36.75 204 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 60 12 48 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 48 12 re f*
+n 108 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 42 12 re f*
+n 6 0 42 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 6 12 re f*
+n 48 0 6 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 42 12 re f*
+n 60 0 42 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-BT 1 0 0 1 0 134 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data1") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (.) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait a bit, so we are sure data2 is written after data1) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data2") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait for the writers to complete) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj 0 0 0 rg T* 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('data1') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('data2') Tj 0 0 0 rg (]) Tj T* ET
+n 102 0 6 12 re f*
+BT 1 0 0 1 0 134 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data1") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (.) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait a bit, so we are sure data2 is written after data1) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data2") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait for the writers to complete) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (datalist) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('data1') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('data2') Tj 0 0 0 rg (]) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 234.4236 cm
+1 0 0 1 62.69291 542.8236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (contextmanager) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 204.4236 cm
+1 0 0 1 62.69291 512.8236 cm
q
-BT 1 0 0 1 0 14 Tm 2.685984 Tw 12 TL /F1 10 Tf 0 0 0 rg (For a long time Python had in its standard library a ) Tj /F4 10 Tf 0 0 0 rg (contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator, able to convert) Tj T* 0 Tw (generator functions into ) Tj /F4 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (factories. For instance if you write) Tj T* ET
+BT 1 0 0 1 0 14 Tm 2.685984 Tw 12 TL /F1 10 Tf 0 0 0 rg (For a long time Python had in its standard library a ) Tj /F3 10 Tf 0 0 0 rg (contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator, able to convert) Tj T* 0 Tw (generator functions into ) Tj /F3 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (factories. For instance if you write) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 111.2236 cm
+1 0 0 1 62.69291 419.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -3981,88 +4352,81 @@ n -6 -6 468.6898 84 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 0 60 6 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
+n 6 60 6 12 re f*
.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
+n 12 60 6 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 24 12 re f*
+n 24 60 24 12 re f*
.960784 .960784 .862745 rg
-n 54 60.75 60 12 re f*
+n 54 60 60 12 re f*
.960784 .960784 .862745 rg
-n 120 60.75 36 12 re f*
+n 120 60 36 12 re f*
.960784 .960784 .862745 rg
-n 162 60.75 84 12 re f*
+n 162 60 84 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 90 12 re f*
+n 24 48 90 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 18 12 re f*
+n 24 36 18 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 72 12 re f*
+n 48 36 72 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
+n 120 36 6 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 36 12 re f*
+n 126 36 36 12 re f*
.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
+n 162 36 6 12 re f*
.960784 .960784 .862745 rg
-n 174 36.75 30 12 re f*
+n 174 36 30 12 re f*
.960784 .960784 .862745 rg
-n 204 36.75 12 12 re f*
+n 204 36 12 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 30 12 re f*
+n 48 24 30 12 re f*
.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
+n 78 24 6 12 re f*
.960784 .960784 .862745 rg
-n 84 24.75 36 12 re f*
+n 84 24 36 12 re f*
.960784 .960784 .862745 rg
-n 120 24.75 6 12 re f*
+n 120 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
+n 48 12 30 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 30 12 re f*
+n 48 0 30 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
+n 78 0 6 12 re f*
.960784 .960784 .862745 rg
-n 84 .75 30 12 re f*
+n 84 0 30 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (contextlib) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (before_after) Tj 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (after) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (yield) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (after) Tj 0 0 0 rg (\)) Tj T* ET
+n 114 0 6 12 re f*
+BT 1 0 0 1 0 62 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (from) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (contextlib) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (import) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (before_after) Tj 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (after) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (yield) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (after) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 79.22362 cm
+1 0 0 1 62.69291 387.6236 cm
q
-BT 1 0 0 1 0 14 Tm .150888 Tw 12 TL /F1 10 Tf 0 0 0 rg (then ) Tj /F4 10 Tf 0 0 0 rg (before_after ) Tj /F1 10 Tf 0 0 0 rg (is a factory function returning ) Tj /F4 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects which can be) Tj T* 0 Tw (used with the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .150888 Tw 12 TL /F1 10 Tf 0 0 0 rg (then ) Tj /F3 10 Tf 0 0 0 rg (before_after ) Tj /F1 10 Tf 0 0 0 rg (is a factory function returning ) Tj /F3 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects which can be) Tj T* 0 Tw (used with the ) Tj /F3 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement:) Tj T* ET
Q
Q
-
-endstream
-endobj
-93 0 obj
-<< /Length 13803 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 655.8236 cm
+1 0 0 1 62.69291 306.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -4072,99 +4436,59 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
+n -6 -6 468.6898 72 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 84.75 72 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 126 84.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 132 84.75 48 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 180 84.75 6 12 re f*
+n 24 48 24 12 re f*
.960784 .960784 .862745 rg
-n 192 84.75 42 12 re f*
+n 54 48 72 12 re f*
.960784 .960784 .862745 rg
-n 234 84.75 6 12 re f*
+n 126 48 6 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
+n 132 48 48 12 re f*
.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
+n 180 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
+n 192 48 42 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 24 12 re f*
+n 234 48 12 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 54 72.75 12 12 re f*
+n 48 36 30 12 re f*
.960784 .960784 .862745 rg
-n 66 72.75 6 12 re f*
+n 78 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 84 36 42 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 30 12 re f*
+n 126 36 6 12 re f*
.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
+n 0 24 36 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 60 12 re f*
+n 0 12 30 12 re f*
.960784 .960784 .862745 rg
-n 108 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 60.75 138 12 re f*
-.960784 .960784 .862745 rg
-n 252 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 258 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 30 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (ba) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (before_after) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('BEFORE') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('AFTER') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (type) Tj 0 0 0 rg (\() Tj 0 0 0 rg (ba) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (') Tj /F3 10 Tf 0 0 1 rg (contextlib) Tj /F4 10 Tf .4 .4 .4 rg (.) Tj 0 0 0 rg (GeneratorContextManager) Tj .729412 .129412 .129412 rg (') Tj (>) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (ba) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
+n 0 0 30 12 re f*
+BT 1 0 0 1 0 50 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (with) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (before_after) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('BEFORE') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('AFTER') Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 611.8236 cm
+1 0 0 1 62.69291 262.4236 cm
q
-BT 1 0 0 1 0 26 Tm .462488 Tw 12 TL /F1 10 Tf 0 0 0 rg (Basically, it is as if the content of the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (block was executed in the place of the ) Tj /F4 10 Tf 0 0 0 rg (yield ) Tj /F1 10 Tf 0 0 0 rg (expression in) Tj T* 0 Tw 2.691797 Tw (the generator function. In Python 3.2 ) Tj /F4 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects were enhanced with a) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (__call__ ) Tj /F1 10 Tf 0 0 0 rg (method, so that they can be used as decorators as in this example:) Tj T* ET
+BT 1 0 0 1 0 26 Tm .462488 Tw 12 TL /F1 10 Tf 0 0 0 rg (Basically, it is as if the content of the ) Tj /F3 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (block was executed in the place of the ) Tj /F3 10 Tf 0 0 0 rg (yield ) Tj /F1 10 Tf 0 0 0 rg (expression in) Tj T* 0 Tw 2.691797 Tw (the generator function. In Python 3.2 ) Tj /F3 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects were enhanced with a) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (__call__ ) Tj /F1 10 Tf 0 0 0 rg (method, so that they can be used as decorators as in this example:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 494.6236 cm
+1 0 0 1 62.69291 145.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -4178,83 +4502,94 @@ n -6 -6 468.6898 108 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
+n 0 84 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 84 6 12 re f*
.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
+n 12 84 6 12 re f*
.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
+n 24 84 18 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 18 12 re f*
+n 0 72 18 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 24 72 18 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
+n 48 72 30 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 30 12 re f*
+n 78 72 18 12 re f*
.960784 .960784 .862745 rg
-n 78 72.75 18 12 re f*
+n 0 60 18 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
+n 48 60 30 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
+n 78 60 6 12 re f*
.960784 .960784 .862745 rg
-n 84 60.75 42 12 re f*
+n 84 60 42 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 126 60 6 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 0 48 18 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 54 36.75 12 12 re f*
+n 24 36 30 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 36 12 re f*
+n 54 36 12 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 30 12 re f*
+n 0 24 36 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 30 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@ba) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (hello) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (hello) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
+n 0 12 30 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 30 12 re f*
+BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@ba) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (hello) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (hello) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 366.6236 cm
+1 0 0 1 62.69291 77.22362 cm
q
-BT 1 0 0 1 0 110 Tm .20561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F4 10 Tf 0 0 0 rg (ba ) Tj /F1 10 Tf 0 0 0 rg (decorator is basically inserting a ) Tj /F4 10 Tf 0 0 0 rg (with) Tj ( ) Tj (ba: ) Tj /F1 10 Tf 0 0 0 rg (block inside the function. However there two issues:) Tj T* 0 Tw 1.402126 Tw (the first is that ) Tj /F4 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects are callable only in Python 3.2, so the previous) Tj T* 0 Tw .356905 Tw (example will break in older versions of Python; the second is that ) Tj /F4 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects) Tj T* 0 Tw .57561 Tw (do not preserve the signature of the decorated functions: the decorated ) Tj /F4 10 Tf 0 0 0 rg (hello ) Tj /F1 10 Tf 0 0 0 rg (function here will have a) Tj T* 0 Tw 3.990814 Tw (generic signature ) Tj /F4 10 Tf 0 0 0 rg (hello\(*args,) Tj ( ) Tj (**kwargs\) ) Tj /F1 10 Tf 0 0 0 rg (but will break when called with more than zero) Tj T* 0 Tw 7.708314 Tw (arguments. For such reasons the decorator module, starting with release 3.4, offers a) Tj T* 0 Tw .616647 Tw /F4 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator that solves both problems and works even in Python 2.5. The) Tj T* 0 Tw .34998 Tw (usage is the same and factories decorated with ) Tj /F4 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (will returns instances of) Tj T* 0 Tw 4.152823 Tw /F4 10 Tf 0 0 0 rg (ContextManager) Tj /F1 10 Tf 0 0 0 rg (, a subclass of ) Tj /F4 10 Tf 0 0 0 rg (contextlib.GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (with a ) Tj /F4 10 Tf 0 0 0 rg (__call__) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (method acting as a signature-preserving decorator.) Tj T* ET
+BT 1 0 0 1 0 50 Tm .20561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F3 10 Tf 0 0 0 rg (ba ) Tj /F1 10 Tf 0 0 0 rg (decorator is basically inserting a ) Tj /F3 10 Tf 0 0 0 rg (with) Tj ( ) Tj (ba: ) Tj /F1 10 Tf 0 0 0 rg (block inside the function. However there two issues: ) Tj T* 0 Tw 1.402126 Tw (the first is that ) Tj /F3 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects are callable only in Python 3.2, so the previous ) Tj T* 0 Tw .356905 Tw (example will break in older versions of Python; the second is that ) Tj /F3 10 Tf 0 0 0 rg (GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects ) Tj T* 0 Tw .57561 Tw (do not preserve the signature of the decorated functions: the decorated ) Tj /F3 10 Tf 0 0 0 rg (hello ) Tj /F1 10 Tf 0 0 0 rg (function here will have a ) Tj T* 0 Tw 3.990814 Tw (generic signature ) Tj /F3 10 Tf 0 0 0 rg (hello\(*args,) Tj ( ) Tj (**kwargs\) ) Tj /F1 10 Tf 0 0 0 rg (but will break when called with more than zero) Tj T* 0 Tw ET
Q
Q
+
+endstream
+endobj
+105 0 obj
+<< /Length 14352 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 336.6236 cm
+1 0 0 1 62.69291 705.0236 cm
q
-BT 1 0 0 1 0 14 Tm 2.756905 Tw 12 TL /F2 10 Tf 0 0 0 rg (Disclaimer) Tj /F1 10 Tf (: the ) Tj /F4 10 Tf 0 0 0 rg (contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator is an ) Tj /F5 10 Tf (experimental ) Tj /F1 10 Tf (feature: it may go away in future) Tj T* 0 Tw (versions of the decorator module. Use it at your own risk.) Tj T* ET
+BT 1 0 0 1 0 50 Tm 7.708314 Tw 12 TL /F1 10 Tf 0 0 0 rg (arguments. For such reasons the decorator module, starting with release 3.4, offers a) Tj T* 0 Tw .616647 Tw /F3 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator that solves both problems and works even in Python 2.5. The) Tj T* 0 Tw .34998 Tw (usage is the same and factories decorated with ) Tj /F3 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (will returns instances of) Tj T* 0 Tw 4.152823 Tw /F3 10 Tf 0 0 0 rg (ContextManager) Tj /F1 10 Tf 0 0 0 rg (, a subclass of ) Tj /F3 10 Tf 0 0 0 rg (contextlib.GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (with a ) Tj /F3 10 Tf 0 0 0 rg (__call__) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (method acting as a signature-preserving decorator.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 303.6236 cm
+1 0 0 1 62.69291 672.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (The ) Tj /F3 17.5 Tf 0 0 0 rg (FunctionMaker ) Tj /F2 17.5 Tf 0 0 0 rg (class) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 237.6236 cm
+1 0 0 1 62.69291 606.0236 cm
q
-BT 1 0 0 1 0 50 Tm 2.241412 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may wonder about how the functionality of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is implemented. The basic) Tj T* 0 Tw 1.545868 Tw (building block is a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class which is able to generate on the fly functions with a given) Tj T* 0 Tw .047485 Tw (name and signature from a function template passed as a string. Generally speaking, you should not need) Tj T* 0 Tw 1.164983 Tw (to resort to ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (when writing ordinary decorators, but it is handy in some circumstances.) Tj T* 0 Tw (You will see an example shortly, in the implementation of a cool decorator utility \() Tj /F4 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (\).) Tj T* ET
+BT 1 0 0 1 0 50 Tm 2.241412 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may wonder about how the functionality of the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is implemented. The basic) Tj T* 0 Tw 1.545868 Tw (building block is a ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class which is able to generate on the fly functions with a given) Tj T* 0 Tw .047485 Tw (name and signature from a function template passed as a string. Generally speaking, you should not need) Tj T* 0 Tw 1.164983 Tw (to resort to ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (when writing ordinary decorators, but it is handy in some circumstances.) Tj T* 0 Tw (You will see an example shortly, in the implementation of a cool decorator utility \() Tj /F3 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (\).) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 195.6236 cm
+1 0 0 1 62.69291 564.0236 cm
q
-BT 1 0 0 1 0 26 Tm .414597 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (provides a ) Tj /F4 10 Tf 0 0 0 rg (.create ) Tj /F1 10 Tf 0 0 0 rg (classmethod which takes as input the name, signature, and body) Tj T* 0 Tw .632927 Tw (of the function we want to generate as well as the execution environment were the function is generated) Tj T* 0 Tw (by ) Tj /F4 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. Here is an example:) Tj T* ET
+BT 1 0 0 1 0 26 Tm .414597 Tw 12 TL /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (provides a ) Tj /F3 10 Tf 0 0 0 rg (.create ) Tj /F1 10 Tf 0 0 0 rg (classmethod which takes as input the name, signature, and body) Tj T* 0 Tw .632927 Tw (of the function we want to generate as well as the execution environment were the function is generated) Tj T* 0 Tw (by ) Tj /F3 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. Here is an example:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 102.4236 cm
+1 0 0 1 62.69291 470.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -4268,142 +4603,139 @@ n -6 -6 468.6898 84 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 0 60 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 60 6 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
+n 12 60 6 12 re f*
.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
+n 24 60 18 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 18 12 re f*
+n 48 60 6 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 6 12 re f*
+n 54 60 6 12 re f*
.960784 .960784 .862745 rg
-n 54 60.75 6 12 re f*
+n 60 60 6 12 re f*
.960784 .960784 .862745 rg
-n 60 60.75 6 12 re f*
+n 66 60 24 12 re f*
.960784 .960784 .862745 rg
-n 66 60.75 24 12 re f*
+n 90 60 6 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
+n 102 60 12 12 re f*
.960784 .960784 .862745 rg
-n 102 60.75 12 12 re f*
+n 114 60 12 12 re f*
.960784 .960784 .862745 rg
-n 114 60.75 12 12 re f*
+n 126 60 12 12 re f*
.960784 .960784 .862745 rg
-n 126 60.75 12 12 re f*
+n 144 60 222 12 re f*
.960784 .960784 .862745 rg
-n 144 60.75 222 12 re f*
+n 0 48 18 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 48 48 30 12 re f*
.960784 .960784 .862745 rg
-n 48 48.75 30 12 re f*
+n 78 48 6 12 re f*
.960784 .960784 .862745 rg
-n 84 48.75 24 12 re f*
+n 84 48 24 12 re f*
.960784 .960784 .862745 rg
-n 108 48.75 6 12 re f*
+n 108 48 6 12 re f*
.960784 .960784 .862745 rg
-n 120 48.75 12 12 re f*
+n 120 48 12 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 132 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
+n 24 24 12 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 78 12 re f*
+n 42 24 6 12 re f*
.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
+n 54 24 78 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 36 12 re f*
+n 132 24 6 12 re f*
.960784 .960784 .862745 rg
-n 174 24.75 6 12 re f*
+n 138 24 36 12 re f*
.960784 .960784 .862745 rg
-n 180 24.75 60 12 re f*
+n 174 24 6 12 re f*
.960784 .960784 .862745 rg
-n 240 24.75 6 12 re f*
+n 180 24 60 12 re f*
.960784 .960784 .862745 rg
-n 252 24.75 54 12 re f*
+n 240 24 6 12 re f*
.960784 .960784 .862745 rg
-n 306 24.75 6 12 re f*
+n 252 24 54 12 re f*
.960784 .960784 .862745 rg
-n 318 24.75 24 12 re f*
+n 306 24 6 12 re f*
.960784 .960784 .862745 rg
-n 342 24.75 6 12 re f*
+n 318 24 24 12 re f*
.960784 .960784 .862745 rg
-n 348 24.75 6 12 re f*
+n 342 24 6 12 re f*
.960784 .960784 .862745 rg
-n 354 24.75 6 12 re f*
+n 348 24 6 12 re f*
.960784 .960784 .862745 rg
-n 360 24.75 6 12 re f*
+n 354 24 6 12 re f*
.960784 .960784 .862745 rg
-n 366 24.75 12 12 re f*
+n 360 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 366 24 12 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 12 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
+n 24 12 12 12 re f*
.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
+n 36 12 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
+n 42 12 6 12 re f*
.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
+n 48 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 60 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
+n 6 0 6 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 6 12 re f*
+n 12 0 6 12 re f*
.960784 .960784 .862745 rg
-n 30 .75 6 12 re f*
+n 24 0 6 12 re f*
.960784 .960784 .862745 rg
-n 42 .75 12 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# a function with a generic signature) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
+n 30 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 42 0 12 12 re f*
+BT 1 0 0 1 0 62 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# a function with a generic signature) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
Q
Q
Q
Q
Q
-
-endstream
-endobj
-94 0 obj
-<< /Length 13724 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 741.0236 cm
+1 0 0 1 62.69291 438.8236 cm
q
-BT 1 0 0 1 0 14 Tm .226654 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is important to notice that the function body is interpolated before being executed, so be careful with the) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (% ) Tj /F1 10 Tf 0 0 0 rg (sign!) Tj T* ET
+BT 1 0 0 1 0 14 Tm .226654 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is important to notice that the function body is interpolated before being executed, so be careful with the) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (% ) Tj /F1 10 Tf 0 0 0 rg (sign!) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 699.0236 cm
+1 0 0 1 62.69291 396.8236 cm
q
-BT 1 0 0 1 0 26 Tm 1.995433 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (also accepts keyword arguments and such arguments are attached to the) Tj T* 0 Tw 1.64686 Tw (resulting function. This is useful if you want to set some function attributes, for instance the docstring) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
+BT 1 0 0 1 0 26 Tm 1.995433 Tw 12 TL /F3 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (also accepts keyword arguments and such arguments are attached to the) Tj T* 0 Tw 1.64686 Tw (resulting function. This is useful if you want to set some function attributes, for instance the docstring) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 657.0236 cm
+1 0 0 1 62.69291 354.8236 cm
q
-BT 1 0 0 1 0 26 Tm .605318 Tw 12 TL /F1 10 Tf 0 0 0 rg (For debugging/introspection purposes it may be useful to see the source code of the generated function;) Tj T* 0 Tw 2.246235 Tw (to do that, just pass the flag ) Tj /F4 10 Tf 0 0 0 rg (addsource=True ) Tj /F1 10 Tf 0 0 0 rg (and a ) Tj /F4 10 Tf 0 0 0 rg (__source__ ) Tj /F1 10 Tf 0 0 0 rg (attribute will be added to the) Tj T* 0 Tw (generated function:) Tj T* ET
+BT 1 0 0 1 0 26 Tm .605318 Tw 12 TL /F1 10 Tf 0 0 0 rg (For debugging/introspection purposes it may be useful to see the source code of the generated function;) Tj T* 0 Tw 2.246235 Tw (to do that, just pass the flag ) Tj /F3 10 Tf 0 0 0 rg (addsource=True ) Tj /F1 10 Tf 0 0 0 rg (and a ) Tj /F3 10 Tf 0 0 0 rg (__source__ ) Tj /F1 10 Tf 0 0 0 rg (attribute will be added to the) Tj T* 0 Tw (generated function:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 563.8236 cm
+1 0 0 1 62.69291 261.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -4417,131 +4749,148 @@ n -6 -6 468.6898 84 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
+n 0 60 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 60 6 12 re f*
.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
+n 12 60 6 12 re f*
.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
+n 24 60 12 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 12 12 re f*
+n 42 60 6 12 re f*
.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
+n 54 60 78 12 re f*
.960784 .960784 .862745 rg
-n 54 60.75 78 12 re f*
+n 132 60 6 12 re f*
.960784 .960784 .862745 rg
-n 132 60.75 6 12 re f*
+n 138 60 36 12 re f*
.960784 .960784 .862745 rg
-n 138 60.75 36 12 re f*
+n 174 60 6 12 re f*
.960784 .960784 .862745 rg
-n 174 60.75 6 12 re f*
+n 0 48 18 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 48 48 60 12 re f*
.960784 .960784 .862745 rg
-n 48 48.75 60 12 re f*
+n 108 48 6 12 re f*
.960784 .960784 .862745 rg
-n 108 48.75 6 12 re f*
+n 120 48 54 12 re f*
.960784 .960784 .862745 rg
-n 120 48.75 54 12 re f*
+n 174 48 6 12 re f*
.960784 .960784 .862745 rg
-n 174 48.75 6 12 re f*
+n 186 48 24 12 re f*
.960784 .960784 .862745 rg
-n 186 48.75 24 12 re f*
+n 210 48 6 12 re f*
.960784 .960784 .862745 rg
-n 210 48.75 6 12 re f*
+n 216 48 6 12 re f*
.960784 .960784 .862745 rg
-n 216 48.75 6 12 re f*
+n 222 48 6 12 re f*
.960784 .960784 .862745 rg
-n 222 48.75 6 12 re f*
+n 228 48 6 12 re f*
.960784 .960784 .862745 rg
-n 228 48.75 6 12 re f*
+n 234 48 12 12 re f*
.960784 .960784 .862745 rg
-n 234 48.75 12 12 re f*
+n 252 48 54 12 re f*
.960784 .960784 .862745 rg
-n 252 48.75 54 12 re f*
+n 306 48 6 12 re f*
.960784 .960784 .862745 rg
-n 306 48.75 6 12 re f*
+n 312 48 24 12 re f*
.960784 .960784 .862745 rg
-n 312 48.75 24 12 re f*
+n 336 48 6 12 re f*
.960784 .960784 .862745 rg
-n 336 48.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 24 36 30 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
+n 54 36 6 12 re f*
.960784 .960784 .862745 rg
-n 60 36.75 12 12 re f*
+n 60 36 12 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 72 36 6 12 re f*
.960784 .960784 .862745 rg
-n 78 36.75 60 12 re f*
+n 78 36 60 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
+n 138 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
+n 0 24 18 12 re f*
.960784 .960784 .862745 rg
-n 36 24.75 6 12 re f*
+n 24 24 12 12 re f*
.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
+n 36 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
+n 42 24 6 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 48 24 6 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 12 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
+n 66 24 12 12 re f*
.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
+n 24 12 6 12 re f*
.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
+n 30 12 6 12 re f*
.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
+n 36 12 6 12 re f*
.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
+n 42 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 60 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (addsource) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__source__) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
+n 6 0 54 12 re f*
+.960784 .960784 .862745 rg
+n 60 0 6 12 re f*
+BT 1 0 0 1 0 62 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (addsource) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__source__) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 423.8236 cm
+1 0 0 1 62.69291 121.6236 cm
q
-BT 1 0 0 1 0 122 Tm .870651 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (can take as first argument a string, as in the examples before, or a function.) Tj T* 0 Tw .224985 Tw (This is the most common usage, since typically you want to decorate a pre-existing function. A framework) Tj T* 0 Tw 1.606136 Tw (author may want to use directly ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (instead of ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (, since it gives you) Tj T* 0 Tw 1.36686 Tw (direct access to the body of the generated function. For instance, suppose you want to instrument the) Tj T* 0 Tw .372209 Tw /F4 10 Tf 0 0 0 rg (__init__ ) Tj /F1 10 Tf 0 0 0 rg (methods of a set of classes, by preserving their signature \(such use case is not made up; this) Tj T* 0 Tw .673828 Tw (is done in SQAlchemy and in other frameworks\). When the first argument of ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create) Tj T* 0 Tw 3.405814 Tw /F1 10 Tf 0 0 0 rg (is a function, a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (object is instantiated internally, with attributes ) Tj /F4 10 Tf 0 0 0 rg (args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (varargs) Tj /F1 10 Tf 0 0 0 rg (,) Tj T* 0 Tw 5.509982 Tw /F4 10 Tf 0 0 0 rg (keywords ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (defaults ) Tj /F1 10 Tf 0 0 0 rg (which are the the return values of the standard library function) Tj T* 0 Tw .561318 Tw /F4 10 Tf 0 0 0 rg (inspect.getargspec) Tj /F1 10 Tf 0 0 0 rg (. For each argument in the ) Tj /F4 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (\(which is a list of strings containing the names) Tj T* 0 Tw 1.599985 Tw (of the mandatory arguments\) an attribute ) Tj /F4 10 Tf 0 0 0 rg (arg0) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (arg1) Tj /F1 10 Tf 0 0 0 rg (, ..., ) Tj /F4 10 Tf 0 0 0 rg (argN ) Tj /F1 10 Tf 0 0 0 rg (is also generated. Finally, there is a) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (signature ) Tj /F1 10 Tf 0 0 0 rg (attribute, a string with the signature of the original function.) Tj T* ET
+BT 1 0 0 1 0 122 Tm .870651 Tw 12 TL /F3 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (can take as first argument a string, as in the examples before, or a function.) Tj T* 0 Tw .224985 Tw (This is the most common usage, since typically you want to decorate a pre-existing function. A framework) Tj T* 0 Tw 1.606136 Tw (author may want to use directly ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (instead of ) Tj /F3 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (, since it gives you) Tj T* 0 Tw 1.36686 Tw (direct access to the body of the generated function. For instance, suppose you want to instrument the) Tj T* 0 Tw .372209 Tw /F3 10 Tf 0 0 0 rg (__init__ ) Tj /F1 10 Tf 0 0 0 rg (methods of a set of classes, by preserving their signature \(such use case is not made up; this) Tj T* 0 Tw .673828 Tw (is done in SQAlchemy and in other frameworks\). When the first argument of ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker.create) Tj T* 0 Tw 3.405814 Tw /F1 10 Tf 0 0 0 rg (is a function, a ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (object is instantiated internally, with attributes ) Tj /F3 10 Tf 0 0 0 rg (args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (varargs) Tj /F1 10 Tf 0 0 0 rg (,) Tj T* 0 Tw 5.509982 Tw /F3 10 Tf 0 0 0 rg (keywords ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (defaults ) Tj /F1 10 Tf 0 0 0 rg (which are the the return values of the standard library function) Tj T* 0 Tw .561318 Tw /F3 10 Tf 0 0 0 rg (inspect.getargspec) Tj /F1 10 Tf 0 0 0 rg (. For each argument in the ) Tj /F3 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (\(which is a list of strings containing the names) Tj T* 0 Tw 1.599985 Tw (of the mandatory arguments\) an attribute ) Tj /F3 10 Tf 0 0 0 rg (arg0) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F3 10 Tf 0 0 0 rg (arg1) Tj /F1 10 Tf 0 0 0 rg (, ..., ) Tj /F3 10 Tf 0 0 0 rg (argN ) Tj /F1 10 Tf 0 0 0 rg (is also generated. Finally, there is a) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (signature ) Tj /F1 10 Tf 0 0 0 rg (attribute, a string with the signature of the original function.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 345.8236 cm
+1 0 0 1 62.69291 79.62362 cm
q
-BT 1 0 0 1 0 62 Tm 4.63311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that while I do not have plans to change or remove the functionality provided in the) Tj T* 0 Tw 1.00936 Tw /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class, I do not guarantee that it will stay unchanged forever. For instance, right now I) Tj T* 0 Tw .791318 Tw (am using the traditional string interpolation syntax for function templates, but Python 2.6 and Python 3.0) Tj T* 0 Tw .712093 Tw (provide a newer interpolation syntax and I may use the new syntax in the future. On the other hand, the) Tj T* 0 Tw .639985 Tw (functionality provided by ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (has been there from version 0.1 and it is guaranteed to stay there) Tj T* 0 Tw (forever.) Tj T* ET
+BT 1 0 0 1 0 26 Tm 4.63311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that while I do not have plans to change or remove the functionality provided in the ) Tj T* 0 Tw 1.00936 Tw /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class, I do not guarantee that it will stay unchanged forever. For instance, right now I ) Tj T* 0 Tw .791318 Tw (am using the traditional string interpolation syntax for function templates, but Python 2.6 and Python 3.0) Tj T* 0 Tw ET
Q
Q
+
+endstream
+endobj
+106 0 obj
+<< /Length 14184 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 312.8236 cm
+1 0 0 1 62.69291 729.0236 cm
+q
+BT 1 0 0 1 0 26 Tm .712093 Tw 12 TL /F1 10 Tf 0 0 0 rg (provide a newer interpolation syntax and I may use the new syntax in the future. On the other hand, the) Tj T* 0 Tw .639985 Tw (functionality provided by ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (has been there from version 0.1 and it is guaranteed to stay there) Tj T* 0 Tw (forever.) Tj T* ET
+Q
+Q
+q
+1 0 0 1 62.69291 696.0236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Getting the source code) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 234.8236 cm
+1 0 0 1 62.69291 618.0236 cm
q
-BT 1 0 0 1 0 62 Tm 5.045529 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (uses ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Therefore) Tj T* 0 Tw 2.542126 Tw /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (will not work for decorated functions. That means that the usual '??' trick in) Tj T* 0 Tw 26.45775 Tw (IPython will give you the \(right on the spot\) message) Tj T* 0 Tw .261647 Tw /F4 10 Tf 0 0 0 rg (Dynamically) Tj ( ) Tj (generated) Tj ( ) Tj (function.) Tj ( ) Tj (No) Tj ( ) Tj (source) Tj ( ) Tj (code available) Tj /F1 10 Tf 0 0 0 rg (. In the past I have considered) Tj T* 0 Tw .945366 Tw (this acceptable, since ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (does not really work even with regular decorators. In that) Tj T* 0 Tw (case ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (gives you the wrapper source code which is probably not what you want:) Tj T* ET
+BT 1 0 0 1 0 62 Tm 5.045529 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (uses ) Tj /F3 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Therefore) Tj T* 0 Tw 2.542126 Tw /F3 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (will not work for decorated functions. That means that the usual '??' trick in) Tj T* 0 Tw 26.45775 Tw (IPython will give you the \(right on the spot\) message) Tj T* 0 Tw .261647 Tw /F3 10 Tf 0 0 0 rg (Dynamically) Tj ( ) Tj (generated) Tj ( ) Tj (function.) Tj ( ) Tj (No) Tj ( ) Tj (source) Tj ( ) Tj (code available) Tj /F1 10 Tf 0 0 0 rg (. In the past I have considered) Tj T* 0 Tw .945366 Tw (this acceptable, since ) Tj /F3 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (does not really work even with regular decorators. In that) Tj T* 0 Tw (case ) Tj /F3 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (gives you the wrapper source code which is probably not what you want:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 165.6236 cm
+1 0 0 1 62.69291 548.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -4555,63 +4904,63 @@ n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 72 12 re f*
+n 24 36 72 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
+n 96 36 6 12 re f*
.960784 .960784 .862745 rg
-n 102 36.75 24 12 re f*
+n 102 36 24 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 12 12 re f*
+n 126 36 12 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
+n 24 24 18 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 42 12 re f*
+n 48 24 42 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
+n 90 24 6 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
+n 96 24 6 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
+n 102 24 24 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
+n 126 24 6 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
+n 138 24 12 12 re f*
.960784 .960784 .862745 rg
-n 150 24.75 12 12 re f*
+n 150 24 12 12 re f*
.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
+n 162 24 12 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 90 12.75 24 12 re f*
+n 90 12 24 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 24 12 re f*
+n 126 12 24 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
+n 150 12 6 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 12 12 re f*
+n 162 12 12 12 re f*
.960784 .960784 .862745 rg
-n 174 12.75 12 12 re f*
+n 174 12 12 12 re f*
.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
+n 186 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 42 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (identity_dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (wrapper) Tj T* ET
+n 66 0 42 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (identity_dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (wrapper) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 84.42362 cm
+1 0 0 1 62.69291 431.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -4621,122 +4970,107 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 72 re B*
+n -6 -6 468.6898 108 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 48.75 78 12 re f*
+n 0 84 78 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 72 18 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 42 12 re f*
+n 24 72 42 12 re f*
.960784 .960784 .862745 rg
-n 66 36.75 18 12 re f*
+n 66 72 18 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 24 12 re f*
+n 90 72 24 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 24 48 36 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 42 12 re f*
+n 66 48 42 12 re f*
.960784 .960784 .862745 rg
-n 102 12.75 6 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 108 12.75 54 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 6 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 168 12.75 42 12 re f*
+n 24 36 30 12 re f*
.960784 .960784 .862745 rg
-n 210 12.75 6 12 re f*
+n 54 36 6 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 18 12 re f*
+n 60 36 42 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 42 12 re f*
+n 102 36 6 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 6 12 re f*
+n 108 36 54 12 re f*
.960784 .960784 .862745 rg
-n 96 .75 6 12 re f*
+n 162 36 6 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 24 12 re f*
+n 168 36 42 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
+n 210 36 12 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 12 12 re f*
+n 24 24 18 12 re f*
.960784 .960784 .862745 rg
-n 150 .75 12 12 re f*
+n 48 24 42 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf .666667 .133333 1 rg (@identity_dec) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (example) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (example) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-95 0 obj
-<< /Length 13714 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 727.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
+n 90 24 6 12 re f*
.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
+n 96 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 102 24 24 12 re f*
+.960784 .960784 .862745 rg
+n 126 24 6 12 re f*
+.960784 .960784 .862745 rg
+n 138 24 12 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
+n 150 24 12 12 re f*
.960784 .960784 .862745 rg
-n 90 12.75 24 12 re f*
+n 162 24 12 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 90 12 24 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 24 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 12 12 re f*
+n 126 12 24 12 re f*
.960784 .960784 .862745 rg
-n 174 12.75 12 12 re f*
+n 150 12 6 12 re f*
.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
+n 162 12 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 174 12 12 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
+n 186 12 6 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
+n 0 0 6 12 re f*
+.960784 .960784 .862745 rg
+n 6 0 54 12 re f*
+.960784 .960784 .862745 rg
+n 60 0 6 12 re f*
+BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf .666667 .133333 1 rg (@identity_dec) Tj 0 0 0 rg T* /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (example) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (import) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (inspect) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (example) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 671.8236 cm
+1 0 0 1 62.69291 375.6236 cm
q
-BT 1 0 0 1 0 38 Tm 1.471235 Tw 12 TL /F1 10 Tf 0 0 0 rg (\(see bug report ) Tj 0 0 .501961 rg (1764286 ) Tj 0 0 0 rg (for an explanation of what is happening\). Unfortunately the bug is still there,) Tj T* 0 Tw 1.541235 Tw (even in Python 2.7 and 3.1. There is however a workaround. The decorator module adds an attribute) Tj T* 0 Tw .103984 Tw /F4 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (to the decorated function, containing a reference to the original function. The easy way to) Tj T* 0 Tw (get the source code is to call ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (on the undecorated function:) Tj T* ET
+BT 1 0 0 1 0 38 Tm 1.471235 Tw 12 TL /F1 10 Tf 0 0 0 rg (\(see bug report ) Tj 0 0 .501961 rg (1764286 ) Tj 0 0 0 rg (for an explanation of what is happening\). Unfortunately the bug is still there,) Tj T* 0 Tw 1.541235 Tw (even in Python 2.7 and 3.1. There is however a workaround. The decorator module adds an attribute) Tj T* 0 Tw .103984 Tw /F3 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (to the decorated function, containing a reference to the original function. The easy way to) Tj T* 0 Tw (get the source code is to call ) Tj /F3 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (on the undecorated function:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 554.6236 cm
+1 0 0 1 62.69291 258.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -4750,113 +5084,115 @@ n -6 -6 468.6898 108 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
+n 0 84 6 12 re f*
.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
+n 6 84 6 12 re f*
.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
+n 12 84 6 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 30 12 re f*
+n 24 84 30 12 re f*
.960784 .960784 .862745 rg
-n 60 84.75 42 12 re f*
+n 54 84 6 12 re f*
.960784 .960784 .862745 rg
-n 102 84.75 6 12 re f*
+n 60 84 42 12 re f*
.960784 .960784 .862745 rg
-n 108 84.75 54 12 re f*
+n 102 84 6 12 re f*
.960784 .960784 .862745 rg
-n 162 84.75 6 12 re f*
+n 108 84 54 12 re f*
.960784 .960784 .862745 rg
-n 168 84.75 54 12 re f*
+n 162 84 6 12 re f*
.960784 .960784 .862745 rg
-n 222 84.75 6 12 re f*
+n 168 84 54 12 re f*
.960784 .960784 .862745 rg
-n 228 84.75 66 12 re f*
+n 222 84 6 12 re f*
.960784 .960784 .862745 rg
-n 294 84.75 6 12 re f*
+n 228 84 66 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 90 12 re f*
+n 294 84 12 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
+n 0 72 90 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 54 12 re f*
+n 0 60 18 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
+n 24 60 54 12 re f*
.960784 .960784 .862745 rg
-n 84 60.75 6 12 re f*
+n 78 60 6 12 re f*
.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
+n 84 60 6 12 re f*
.960784 .960784 .862745 rg
-n 102 60.75 18 12 re f*
+n 90 60 6 12 re f*
.960784 .960784 .862745 rg
-n 120 60.75 6 12 re f*
+n 102 60 18 12 re f*
.960784 .960784 .862745 rg
-n 126 60.75 6 12 re f*
+n 120 60 6 12 re f*
.960784 .960784 .862745 rg
-n 132 60.75 12 12 re f*
+n 126 60 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 144 12 re f*
+n 132 60 12 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 12 12 re f*
+n 24 48 144 12 re f*
.960784 .960784 .862745 rg
-n 42 36.75 6 12 re f*
+n 24 36 12 12 re f*
.960784 .960784 .862745 rg
-n 54 36.75 12 12 re f*
+n 42 36 6 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 54 36 12 12 re f*
.960784 .960784 .862745 rg
-n 78 36.75 6 12 re f*
+n 72 36 6 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 36 12 re f*
+n 78 36 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 18 12 re f*
+n 48 24 36 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 36 12 re f*
+n 90 24 18 12 re f*
.960784 .960784 .862745 rg
-n 66 12.75 54 12 re f*
+n 24 12 36 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 66 12 54 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 132 12.75 6 12 re f*
+n 126 12 6 12 re f*
.960784 .960784 .862745 rg
-n 138 12.75 6 12 re f*
+n 132 12 6 12 re f*
.960784 .960784 .862745 rg
-n 144 12.75 6 12 re f*
+n 138 12 6 12 re f*
.960784 .960784 .862745 rg
-n 156 12.75 6 12 re f*
+n 144 12 6 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 6 12 re f*
+n 156 12 6 12 re f*
.960784 .960784 .862745 rg
-n 168 12.75 18 12 re f*
+n 162 12 6 12 re f*
.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
+n 168 12 18 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
+n 186 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (factorial) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__wrapped__) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
+n 6 0 54 12 re f*
+.960784 .960784 .862745 rg
+n 60 0 6 12 re f*
+BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (factorial) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__wrapped__) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 521.6236 cm
+1 0 0 1 62.69291 225.4236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Dealing with third party decorators) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 467.6236 cm
+1 0 0 1 62.69291 171.4236 cm
q
-BT 1 0 0 1 0 38 Tm .321654 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes you find on the net some cool decorator that you would like to include in your code. However,) Tj T* 0 Tw .50061 Tw (more often than not the cool decorator is not signature-preserving. Therefore you may want an easy way) Tj T* 0 Tw 1.814597 Tw (to upgrade third party decorators to signature-preserving decorators without having to rewrite them in) Tj T* 0 Tw (terms of ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (. You can use a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (to implement that functionality as follows:) Tj T* ET
+BT 1 0 0 1 0 38 Tm .321654 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes you find on the net some cool decorator that you would like to include in your code. However,) Tj T* 0 Tw .50061 Tw (more often than not the cool decorator is not signature-preserving. Therefore you may want an easy way) Tj T* 0 Tw 1.814597 Tw (to upgrade third party decorators to signature-preserving decorators without having to rewrite them in) Tj T* 0 Tw (terms of ) Tj /F3 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (. You can use a ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (to implement that functionality as follows:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 350.4236 cm
+1 0 0 1 62.69291 78.22362 cm
q
q
1 0 0 1 0 0 cm
@@ -4866,103 +5202,130 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
+n -6 -6 468.6898 84 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 18 12 re f*
+n 0 60 18 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 90 12 re f*
+n 24 60 90 12 re f*
.960784 .960784 .862745 rg
-n 114 84.75 6 12 re f*
+n 114 60 6 12 re f*
.960784 .960784 .862745 rg
-n 120 84.75 18 12 re f*
+n 120 60 18 12 re f*
.960784 .960784 .862745 rg
-n 138 84.75 6 12 re f*
+n 138 60 6 12 re f*
.960784 .960784 .862745 rg
-n 150 84.75 24 12 re f*
+n 150 60 24 12 re f*
.960784 .960784 .862745 rg
-n 174 84.75 12 12 re f*
+n 174 60 12 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
+n 24 48 18 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 378 12 re f*
+n 0 36 378 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 264 12 re f*
+n 0 24 264 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 42 12 re f*
+n 0 12 42 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 78 12 re f*
+n 66 0 78 12 re f*
.960784 .960784 .862745 rg
-n 144 24.75 6 12 re f*
+n 144 0 6 12 re f*
.960784 .960784 .862745 rg
-n 150 24.75 36 12 re f*
+n 150 0 36 12 re f*
.960784 .960784 .862745 rg
-n 186 24.75 6 12 re f*
+n 186 0 6 12 re f*
+BT 1 0 0 1 0 62 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (dec) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( Decorate a function by preserving the signature even if dec) Tj T* ( is not a signature-preserving decorator.) Tj T* ( """) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* ET
+Q
+Q
+Q
+Q
+Q
+
+endstream
+endobj
+107 0 obj
+<< /Length 16300 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
+q
+1 0 0 1 62.69291 727.8236 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
.960784 .960784 .862745 rg
-n 48 12.75 24 12 re f*
+n -6 -6 468.6898 36 re B*
+Q
+q
+.960784 .960784 .862745 rg
+n 48 12 24 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
+n 72 12 6 12 re f*
.960784 .960784 .862745 rg
-n 84 12.75 108 12 re f*
+n 84 12 108 12 re f*
.960784 .960784 .862745 rg
-n 192 12.75 78 12 re f*
+n 192 12 78 12 re f*
.960784 .960784 .862745 rg
-n 270 12.75 12 12 re f*
+n 270 12 12 12 re f*
.960784 .960784 .862745 rg
-n 282 12.75 6 12 re f*
+n 282 12 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 48 0 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 72 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 54 12 re f*
+n 78 0 54 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
+n 138 0 18 12 re f*
.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
+n 156 0 6 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 24 12 re f*
+n 162 0 24 12 re f*
.960784 .960784 .862745 rg
-n 186 .75 18 12 re f*
+n 186 0 18 12 re f*
.960784 .960784 .862745 rg
-n 210 .75 66 12 re f*
+n 210 0 66 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
+n 276 0 6 12 re f*
.960784 .960784 .862745 rg
-n 282 .75 24 12 re f*
+n 282 0 24 12 re f*
.960784 .960784 .862745 rg
-n 306 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (dec) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( Decorate a function by preserving the signature even if dec) Tj T* ( is not a signature-preserving decorator.) Tj T* ( """) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('return decorated\() Tj /F3 10 Tf .733333 .4 .533333 rg (%\(signature\)s) Tj /F4 10 Tf .729412 .129412 .129412 rg (\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (decorated) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (__wrapped__) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
+n 306 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('return decorated\() Tj /F5 10 Tf .733333 .4 .533333 rg (%\(signature\)s) Tj /F3 10 Tf .729412 .129412 .129412 rg (\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (decorated) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (__wrapped__) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 318.4236 cm
+1 0 0 1 62.69291 695.8236 cm
q
-BT 1 0 0 1 0 14 Tm .698314 Tw 12 TL /F4 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (sets the attribute ) Tj /F4 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (of the generated function to the original function,) Tj T* 0 Tw (so that you can get the right source code.) Tj T* ET
+BT 1 0 0 1 0 14 Tm .698314 Tw 12 TL /F3 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (sets the attribute ) Tj /F3 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (of the generated function to the original function,) Tj T* 0 Tw (so that you can get the right source code.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 276.4236 cm
+1 0 0 1 62.69291 653.8236 cm
q
-BT 1 0 0 1 0 26 Tm .13104 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that I am not providing this functionality in the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module directly since I think it is best to) Tj T* 0 Tw 2.070751 Tw (rewrite the decorator rather than adding an additional level of indirection. However, practicality beats) Tj T* 0 Tw (purity, so you can add ) Tj /F4 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (to your toolbox and use it if you need to.) Tj T* ET
+BT 1 0 0 1 0 26 Tm .13104 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that I am not providing this functionality in the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module directly since I think it is best to) Tj T* 0 Tw 2.070751 Tw (rewrite the decorator rather than adding an additional level of indirection. However, practicality beats) Tj T* 0 Tw (purity, so you can add ) Tj /F3 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (to your toolbox and use it if you need to.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 222.4236 cm
+1 0 0 1 62.69291 599.8236 cm
q
-BT 1 0 0 1 0 38 Tm 1.74881 Tw 12 TL /F1 10 Tf 0 0 0 rg (In order to give an example of usage of ) Tj /F4 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (, I will show a pretty slick decorator that) Tj T* 0 Tw 1.276651 Tw (converts a tail-recursive function in an iterative function. I have shamelessly stolen the basic idea from) Tj T* 0 Tw 43.62829 Tw (Kay Schluehr's recipe in the Python Cookbook,) Tj T* 0 Tw 0 0 .501961 rg (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj 0 0 0 rg (.) Tj T* ET
+BT 1 0 0 1 0 38 Tm 1.74881 Tw 12 TL /F1 10 Tf 0 0 0 rg (In order to give an example of usage of ) Tj /F3 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (, I will show a pretty slick decorator that) Tj T* 0 Tw 1.276651 Tw (converts a tail-recursive function in an iterative function. I have shamelessly stolen the basic idea from) Tj T* 0 Tw 43.62829 Tw (Kay Schluehr's recipe in the Python Cookbook,) Tj T* 0 Tw 0 0 .501961 rg (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj 0 0 0 rg (.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 81.22362 cm
+1 0 0 1 62.69291 230.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -4972,285 +5335,258 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 132 re B*
+n -6 -6 468.6898 360 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 108.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 36 108.75 78 12 re f*
+n 0 336 30 12 re f*
.960784 .960784 .862745 rg
-n 114 108.75 6 12 re f*
+n 36 336 78 12 re f*
.960784 .960784 .862745 rg
-n 120 108.75 36 12 re f*
+n 114 336 6 12 re f*
.960784 .960784 .862745 rg
-n 156 108.75 12 12 re f*
+n 120 336 36 12 re f*
.960784 .960784 .862745 rg
-n 24 96.75 18 12 re f*
+n 156 336 12 12 re f*
.960784 .960784 .862745 rg
-n 0 84.75 354 12 re f*
+n 24 324 18 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 396 12 re f*
+n 0 312 354 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 276 12 re f*
+n 0 300 396 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 42 12 re f*
+n 0 288 276 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
+n 0 276 42 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 48 12 re f*
+n 24 252 18 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
+n 48 252 48 12 re f*
.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
+n 96 252 6 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
+n 102 252 24 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 24 12 re f*
+n 126 252 6 12 re f*
.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
+n 138 252 24 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 24 12 re f*
+n 162 252 12 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
+n 48 240 24 12 re f*
.960784 .960784 .862745 rg
-n 78 12.75 24 12 re f*
+n 72 240 6 12 re f*
.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
+n 78 240 24 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 24 12 re f*
+n 108 240 6 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
+n 120 240 24 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
+n 48 228 24 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 54 12 re f*
+n 72 228 6 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
+n 78 228 54 12 re f*
.960784 .960784 .862745 rg
-n 150 .75 24 12 re f*
-BT 1 0 0 1 0 110 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (TailRecursive) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( tail_recursive decorator based on Kay Schluehr's recipe) Tj T* ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj T* ( with improvements by me and George Sakkis.) Tj T* ( """) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-96 0 obj
-<< /Length 16920 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 523.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
+n 138 228 6 12 re f*
.960784 .960784 .862745 rg
-n -6 -6 468.6898 240 re B*
-Q
-q
+n 150 228 24 12 re f*
.960784 .960784 .862745 rg
-n 48 216.75 24 12 re f*
+n 48 216 24 12 re f*
.960784 .960784 .862745 rg
-n 72 216.75 6 12 re f*
+n 72 216 6 12 re f*
.960784 .960784 .862745 rg
-n 78 216.75 48 12 re f*
+n 78 216 48 12 re f*
.960784 .960784 .862745 rg
-n 132 216.75 6 12 re f*
+n 132 216 6 12 re f*
.960784 .960784 .862745 rg
-n 144 216.75 36 12 re f*
+n 144 216 36 12 re f*
.960784 .960784 .862745 rg
-n 180 216.75 12 12 re f*
+n 180 216 12 12 re f*
.960784 .960784 .862745 rg
-n 204 216.75 60 12 re f*
+n 204 216 60 12 re f*
.960784 .960784 .862745 rg
-n 24 192.75 18 12 re f*
+n 24 192 18 12 re f*
.960784 .960784 .862745 rg
-n 48 192.75 48 12 re f*
+n 48 192 48 12 re f*
.960784 .960784 .862745 rg
-n 96 192.75 6 12 re f*
+n 96 192 6 12 re f*
.960784 .960784 .862745 rg
-n 102 192.75 24 12 re f*
+n 102 192 24 12 re f*
.960784 .960784 .862745 rg
-n 126 192.75 6 12 re f*
+n 126 192 6 12 re f*
.960784 .960784 .862745 rg
-n 138 192.75 6 12 re f*
+n 138 192 6 12 re f*
.960784 .960784 .862745 rg
-n 144 192.75 24 12 re f*
+n 144 192 24 12 re f*
.960784 .960784 .862745 rg
-n 168 192.75 6 12 re f*
+n 168 192 6 12 re f*
.960784 .960784 .862745 rg
-n 180 192.75 12 12 re f*
+n 180 192 12 12 re f*
.960784 .960784 .862745 rg
-n 192 192.75 18 12 re f*
+n 192 192 18 12 re f*
.960784 .960784 .862745 rg
-n 210 192.75 12 12 re f*
+n 210 192 12 12 re f*
.960784 .960784 .862745 rg
-n 48 180.75 48 12 re f*
+n 48 180 48 12 re f*
.960784 .960784 .862745 rg
-n 102 180.75 6 12 re f*
+n 102 180 6 12 re f*
.960784 .960784 .862745 rg
-n 114 180.75 24 12 re f*
+n 114 180 24 12 re f*
.960784 .960784 .862745 rg
-n 138 180.75 6 12 re f*
+n 138 180 6 12 re f*
.960784 .960784 .862745 rg
-n 144 180.75 48 12 re f*
+n 144 180 48 12 re f*
.960784 .960784 .862745 rg
-n 48 168.75 12 12 re f*
+n 48 168 12 12 re f*
.960784 .960784 .862745 rg
-n 66 168.75 24 12 re f*
+n 66 168 24 12 re f*
.960784 .960784 .862745 rg
-n 90 168.75 6 12 re f*
+n 90 168 6 12 re f*
.960784 .960784 .862745 rg
-n 96 168.75 54 12 re f*
+n 96 168 54 12 re f*
.960784 .960784 .862745 rg
-n 150 168.75 6 12 re f*
+n 150 168 6 12 re f*
.960784 .960784 .862745 rg
-n 72 156.75 24 12 re f*
+n 72 156 24 12 re f*
.960784 .960784 .862745 rg
-n 102 156.75 6 12 re f*
+n 102 156 6 12 re f*
.960784 .960784 .862745 rg
-n 114 156.75 24 12 re f*
+n 114 156 24 12 re f*
.960784 .960784 .862745 rg
-n 138 156.75 6 12 re f*
+n 138 156 6 12 re f*
.960784 .960784 .862745 rg
-n 144 156.75 24 12 re f*
+n 144 156 24 12 re f*
.960784 .960784 .862745 rg
-n 72 144.75 24 12 re f*
+n 72 144 24 12 re f*
.960784 .960784 .862745 rg
-n 96 144.75 6 12 re f*
+n 96 144 6 12 re f*
.960784 .960784 .862745 rg
-n 102 144.75 54 12 re f*
+n 102 144 54 12 re f*
.960784 .960784 .862745 rg
-n 162 144.75 6 12 re f*
+n 162 144 6 12 re f*
.960784 .960784 .862745 rg
-n 174 144.75 30 12 re f*
+n 174 144 30 12 re f*
.960784 .960784 .862745 rg
-n 72 132.75 18 12 re f*
+n 72 132 18 12 re f*
.960784 .960784 .862745 rg
-n 90 132.75 6 12 re f*
+n 90 132 6 12 re f*
.960784 .960784 .862745 rg
-n 96 120.75 30 12 re f*
+n 96 120 30 12 re f*
.960784 .960784 .862745 rg
-n 132 120.75 24 12 re f*
+n 132 120 24 12 re f*
.960784 .960784 .862745 rg
-n 156 120.75 6 12 re f*
+n 156 120 6 12 re f*
.960784 .960784 .862745 rg
-n 120 108.75 36 12 re f*
+n 120 108 36 12 re f*
.960784 .960784 .862745 rg
-n 162 108.75 6 12 re f*
+n 162 108 6 12 re f*
.960784 .960784 .862745 rg
-n 174 108.75 24 12 re f*
+n 174 108 24 12 re f*
.960784 .960784 .862745 rg
-n 198 108.75 6 12 re f*
+n 198 108 6 12 re f*
.960784 .960784 .862745 rg
-n 204 108.75 6 12 re f*
+n 204 108 6 12 re f*
.960784 .960784 .862745 rg
-n 210 108.75 24 12 re f*
+n 210 108 24 12 re f*
.960784 .960784 .862745 rg
-n 234 108.75 6 12 re f*
+n 234 108 6 12 re f*
.960784 .960784 .862745 rg
-n 246 108.75 12 12 re f*
+n 246 108 12 12 re f*
.960784 .960784 .862745 rg
-n 258 108.75 18 12 re f*
+n 258 108 18 12 re f*
.960784 .960784 .862745 rg
-n 276 108.75 6 12 re f*
+n 276 108 6 12 re f*
.960784 .960784 .862745 rg
-n 120 96.75 12 12 re f*
+n 120 96 12 12 re f*
.960784 .960784 .862745 rg
-n 138 96.75 36 12 re f*
+n 138 96 36 12 re f*
.960784 .960784 .862745 rg
-n 180 96.75 12 12 re f*
+n 180 96 12 12 re f*
.960784 .960784 .862745 rg
-n 198 96.75 48 12 re f*
+n 198 96 48 12 re f*
.960784 .960784 .862745 rg
-n 246 96.75 6 12 re f*
+n 246 96 6 12 re f*
.960784 .960784 .862745 rg
-n 264 96.75 108 12 re f*
+n 264 96 108 12 re f*
.960784 .960784 .862745 rg
-n 144 84.75 24 12 re f*
+n 144 84 24 12 re f*
.960784 .960784 .862745 rg
-n 168 84.75 6 12 re f*
+n 168 84 6 12 re f*
.960784 .960784 .862745 rg
-n 180 84.75 18 12 re f*
+n 180 84 18 12 re f*
.960784 .960784 .862745 rg
-n 204 84.75 6 12 re f*
+n 204 84 6 12 re f*
.960784 .960784 .862745 rg
-n 216 84.75 24 12 re f*
+n 216 84 24 12 re f*
.960784 .960784 .862745 rg
-n 240 84.75 6 12 re f*
+n 240 84 6 12 re f*
.960784 .960784 .862745 rg
-n 246 84.75 42 12 re f*
+n 246 84 42 12 re f*
.960784 .960784 .862745 rg
-n 120 72.75 24 12 re f*
+n 120 72 24 12 re f*
.960784 .960784 .862745 rg
-n 144 72.75 6 12 re f*
+n 144 72 6 12 re f*
.960784 .960784 .862745 rg
-n 162 72.75 66 12 re f*
+n 162 72 66 12 re f*
.960784 .960784 .862745 rg
-n 144 60.75 36 12 re f*
+n 144 60 36 12 re f*
.960784 .960784 .862745 rg
-n 186 60.75 36 12 re f*
+n 186 60 36 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 42 12 re f*
+n 72 48 42 12 re f*
.960784 .960784 .862745 rg
-n 114 48.75 6 12 re f*
+n 114 48 6 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
+n 96 36 24 12 re f*
.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
+n 120 36 6 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 54 12 re f*
+n 126 36 54 12 re f*
.960784 .960784 .862745 rg
-n 186 36.75 6 12 re f*
+n 186 36 6 12 re f*
.960784 .960784 .862745 rg
-n 198 36.75 24 12 re f*
+n 198 36 24 12 re f*
.960784 .960784 .862745 rg
-n 48 24.75 24 12 re f*
+n 48 24 24 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 90 24.75 234 12 re f*
+n 90 24 234 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 24 12 re f*
+n 72 12 24 12 re f*
.960784 .960784 .862745 rg
-n 96 12.75 6 12 re f*
+n 96 12 6 12 re f*
.960784 .960784 .862745 rg
-n 102 12.75 42 12 re f*
+n 102 12 42 12 re f*
.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
+n 150 12 6 12 re f*
.960784 .960784 .862745 rg
-n 162 12.75 24 12 re f*
+n 162 12 24 12 re f*
.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
+n 186 12 6 12 re f*
.960784 .960784 .862745 rg
-n 198 12.75 18 12 re f*
+n 198 12 18 12 re f*
.960784 .960784 .862745 rg
-n 72 .75 36 12 re f*
+n 72 0 36 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 48 12 re f*
-BT 1 0 0 1 0 218 Tm 12 TL /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# sentinel) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (False) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (while) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (is) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# update arguments) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# last call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (finally) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# return the arguments of the tail call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj T* ET
+n 114 0 48 12 re f*
+BT 1 0 0 1 0 338 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (class) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 0 1 rg (TailRecursive) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( tail_recursive decorator based on Kay Schluehr's recipe) Tj T* ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj T* ( with improvements by me and George Sakkis.) Tj T* ( """) Tj /F3 10 Tf 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# sentinel) Tj /F3 10 Tf 0 0 0 rg T* T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (False) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (try) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (while) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (is) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# update arguments) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# last call) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (finally) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (else) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# return the arguments of the tail call) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 503.8236 cm
+1 0 0 1 62.69291 210.6236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here the decorator is implemented as a class returning callable objects.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 458.6236 cm
+1 0 0 1 62.69291 165.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -5264,44 +5600,44 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 84 12 re f*
+n 24 12 84 12 re f*
.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
+n 108 12 6 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 24 12 re f*
+n 114 12 24 12 re f*
.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
+n 138 12 12 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 90 12 re f*
+n 66 0 90 12 re f*
.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
+n 156 0 6 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 78 12 re f*
+n 162 0 78 12 re f*
.960784 .960784 .862745 rg
-n 240 .75 6 12 re f*
+n 240 0 6 12 re f*
.960784 .960784 .862745 rg
-n 252 .75 24 12 re f*
+n 252 0 24 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (tail_recursive) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (TailRecursive) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
+n 276 0 6 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (tail_recursive) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (TailRecursive) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 438.6236 cm
+1 0 0 1 62.69291 145.4236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is how you apply the upgraded decorator to the good old factorial:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 345.4236 cm
+1 0 0 1 62.69291 88.22362 cm
q
q
1 0 0 1 0 0 cm
@@ -5311,75 +5647,102 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 84 re B*
+n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 60.75 90 12 re f*
+n 0 24 90 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 54 12 re f*
+n 24 12 54 12 re f*
.960784 .960784 .862745 rg
-n 78 48.75 6 12 re f*
+n 78 12 6 12 re f*
.960784 .960784 .862745 rg
-n 84 48.75 6 12 re f*
+n 84 12 6 12 re f*
.960784 .960784 .862745 rg
-n 90 48.75 6 12 re f*
+n 90 12 6 12 re f*
.960784 .960784 .862745 rg
-n 102 48.75 18 12 re f*
+n 102 12 18 12 re f*
.960784 .960784 .862745 rg
-n 120 48.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 48.75 6 12 re f*
+n 126 12 6 12 re f*
.960784 .960784 .862745 rg
-n 132 48.75 12 12 re f*
+n 132 12 12 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 144 12 re f*
+n 24 0 144 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ET
+Q
+Q
+Q
+Q
+Q
+
+endstream
+endobj
+108 0 obj
+<< /Length 7695 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
+q
+1 0 0 1 62.69291 715.8236 cm
+q
+q
+1 0 0 1 0 0 cm
+q
+1 0 0 1 6.6 6.6 cm
+q
+.662745 .662745 .662745 RG
+.5 w
+.960784 .960784 .862745 rg
+n -6 -6 468.6898 48 re B*
+Q
+q
.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
+n 24 24 12 12 re f*
.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
+n 42 24 6 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 12 12 re f*
+n 54 24 12 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
+n 78 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 90 12.75 18 12 re f*
+n 90 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
+n 66 0 54 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
+n 126 0 6 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
+n 138 0 6 12 re f*
.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
+n 144 0 6 12 re f*
.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
+n 156 0 6 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
+n 162 0 6 12 re f*
.960784 .960784 .862745 rg
-n 168 .75 18 12 re f*
+n 168 0 18 12 re f*
.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj T* ET
+n 186 0 6 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 300.2236 cm
+1 0 0 1 62.69291 670.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -5393,37 +5756,39 @@ n -6 -6 468.6898 36 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
+n 24 12 30 12 re f*
.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
+n 60 12 54 12 re f*
.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
+n 114 12 6 12 re f*
.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
+n 120 12 6 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 12 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (24) Tj T* ET
+n 126 12 12 12 re f*
+.960784 .960784 .862745 rg
+n 0 0 12 12 re f*
+BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (24) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 244.2236 cm
+1 0 0 1 62.69291 614.6236 cm
q
-BT 1 0 0 1 0 38 Tm .188935 Tw 12 TL /F1 10 Tf 0 0 0 rg (This decorator is pretty impressive, and should give you some food for your mind ;\) Notice that there is no) Tj T* 0 Tw 1.339983 Tw (recursion limit now, and you can easily compute ) Tj /F4 10 Tf 0 0 0 rg (factorial\(1001\) ) Tj /F1 10 Tf 0 0 0 rg (or larger without filling the stack) Tj T* 0 Tw .909431 Tw (frame. Notice also that the decorator will not work on functions which are not tail recursive, such as the) Tj T* 0 Tw (following) Tj T* ET
+BT 1 0 0 1 0 38 Tm .188935 Tw 12 TL /F1 10 Tf 0 0 0 rg (This decorator is pretty impressive, and should give you some food for your mind ;\) Notice that there is no) Tj T* 0 Tw 1.339983 Tw (recursion limit now, and you can easily compute ) Tj /F3 10 Tf 0 0 0 rg (factorial\(1001\) ) Tj /F1 10 Tf 0 0 0 rg (or larger without filling the stack) Tj T* 0 Tw .909431 Tw (frame. Notice also that the decorator will not work on functions which are not tail recursive, such as the) Tj T* 0 Tw (following) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 175.0236 cm
+1 0 0 1 62.69291 545.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -5437,84 +5802,77 @@ n -6 -6 468.6898 60 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
+n 0 36 18 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 24 12 re f*
+n 24 36 24 12 re f*
.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
+n 48 36 6 12 re f*
.960784 .960784 .862745 rg
-n 54 36.75 6 12 re f*
+n 54 36 6 12 re f*
.960784 .960784 .862745 rg
-n 60 36.75 12 12 re f*
+n 60 36 12 12 re f*
.960784 .960784 .862745 rg
-n 84 36.75 168 12 re f*
+n 84 36 168 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
+n 24 24 12 12 re f*
.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
+n 42 24 6 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 12 12 re f*
+n 54 24 12 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
+n 78 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
+n 48 12 36 12 re f*
.960784 .960784 .862745 rg
-n 90 12.75 6 12 re f*
+n 90 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 6 12 re f*
+n 66 0 6 12 re f*
.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
+n 78 0 6 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 24 12 re f*
+n 90 0 24 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
+n 114 0 6 12 re f*
.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
+n 126 0 6 12 re f*
.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# this is not tail-recursive) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj T* ET
+n 138 0 6 12 re f*
+BT 1 0 0 1 0 38 Tm 12 TL /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# this is not tail-recursive) Tj /F3 10 Tf 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (if) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 143.0236 cm
+1 0 0 1 62.69291 513.4236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .541098 Tw (\(reminder: a function is tail recursive if it either returns a value without making a recursive call, or returns) Tj T* 0 Tw (directly the result of a recursive call\).) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 110.0236 cm
+1 0 0 1 62.69291 480.4236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Caveats and limitations) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 80.02362 cm
+1 0 0 1 62.69291 450.4236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .474987 Tw (The first thing you should be aware of, it the fact that decorators have a performance penalty. The worse) Tj T* 0 Tw (case is shown by the following example:) Tj T* ET
Q
Q
-
-endstream
-endobj
-97 0 obj
-<< /Length 10417 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 547.8236 cm
+1 0 0 1 62.69291 225.2236 cm
q
q
1 0 0 1 0 0 cm
@@ -5528,20 +5886,20 @@ n -6 -6 468.6898 216 re B*
Q
q
0 0 0 rg
-BT 1 0 0 1 0 194 Tm /F4 10 Tf 12 TL ($ cat performance.sh) Tj T* (python -m timeit -s ") Tj T* (from decorator import decorator) Tj T* T* (@decorator) Tj T* (def do_nothing\(func, *args, **kw\):) Tj T* ( return func\(*args, **kw\)) Tj T* T* (@do_nothing) Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* T* (python -m timeit -s ") Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* ET
+BT 1 0 0 1 0 194 Tm /F3 10 Tf 12 TL ($ cat performance.sh) Tj T* (python3 -m timeit -s ") Tj T* (from decorator import decorator) Tj T* T* (@decorator) Tj T* (def do_nothing\(func, *args, **kw\):) Tj T* ( return func\(*args, **kw\)) Tj T* T* (@do_nothing) Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* T* (python3 -m timeit -s ") Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 515.8236 cm
+1 0 0 1 62.69291 193.2236 cm
q
-BT 1 0 0 1 0 14 Tm .266235 Tw 12 TL /F1 10 Tf 0 0 0 rg (On my MacBook, using the ) Tj /F4 10 Tf 0 0 0 rg (do_nothing ) Tj /F1 10 Tf 0 0 0 rg (decorator instead of the plain function is more than three times) Tj T* 0 Tw (slower:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .266235 Tw 12 TL /F1 10 Tf 0 0 0 rg (On my MacBook, using the ) Tj /F3 10 Tf 0 0 0 rg (do_nothing ) Tj /F1 10 Tf 0 0 0 rg (decorator instead of the plain function is more than three times) Tj T* 0 Tw (slower:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 458.6236 cm
+1 0 0 1 62.69291 136.0236 cm
q
q
1 0 0 1 0 0 cm
@@ -5555,27 +5913,34 @@ n -6 -6 468.6898 48 re B*
Q
q
0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F4 10 Tf 12 TL ($ bash performance.sh) Tj T* (1000000 loops, best of 3: 0.995 usec per loop) Tj T* (1000000 loops, best of 3: 0.273 usec per loop) Tj T* ET
+BT 1 0 0 1 0 26 Tm /F3 10 Tf 12 TL ($ bash performance.sh) Tj T* (1000000 loops, best of 3: 0.669 usec per loop) Tj T* (1000000 loops, best of 3: 0.181 usec per loop) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 414.6236 cm
+1 0 0 1 62.69291 92.02362 cm
q
-BT 1 0 0 1 0 26 Tm 1.25832 Tw 12 TL /F1 10 Tf 0 0 0 rg (It should be noted that a real life function would probably do something more useful than ) Tj /F4 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (here, and) Tj T* 0 Tw .91811 Tw (therefore in real life the performance penalty could be completely negligible. As always, the only way to) Tj T* 0 Tw (know if there is a penalty in your specific use case is to measure it.) Tj T* ET
+BT 1 0 0 1 0 26 Tm 1.25832 Tw 12 TL /F1 10 Tf 0 0 0 rg (It should be noted that a real life function would probably do something more useful than ) Tj /F3 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (here, and) Tj T* 0 Tw .91811 Tw (therefore in real life the performance penalty could be completely negligible. As always, the only way to) Tj T* 0 Tw (know if there is a penalty in your specific use case is to measure it.) Tj T* ET
Q
Q
+
+endstream
+endobj
+109 0 obj
+<< /Length 16759 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 384.6236 cm
+1 0 0 1 62.69291 741.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .867984 Tw (You should be aware that decorators will make your tracebacks longer and more difficult to understand.) Tj T* 0 Tw (Consider this example:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 327.4236 cm
+1 0 0 1 62.69291 683.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -5589,43 +5954,43 @@ n -6 -6 468.6898 48 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
+n 24 24 36 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 18 12 re f*
+n 24 12 18 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
+n 48 12 6 12 re f*
.960784 .960784 .862745 rg
-n 54 12.75 18 12 re f*
+n 54 12 18 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
+n 0 0 18 12 re f*
.960784 .960784 .862745 rg
-n 48 .75 6 12 re f*
+n 48 0 6 12 re f*
.960784 .960784 .862745 rg
-n 54 .75 6 12 re f*
+n 54 0 6 12 re f*
.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj T* ET
+n 60 0 6 12 re f*
+BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 295.4236 cm
+1 0 0 1 62.69291 651.8236 cm
q
-BT 1 0 0 1 0 14 Tm .583318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Calling ) Tj /F4 10 Tf 0 0 0 rg (f\(\) ) Tj /F1 10 Tf 0 0 0 rg (will give you a ) Tj /F4 10 Tf 0 0 0 rg (ZeroDivisionError) Tj /F1 10 Tf 0 0 0 rg (, but since the function is decorated the traceback will) Tj T* 0 Tw (be longer:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .583318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Calling ) Tj /F3 10 Tf 0 0 0 rg (f\(\) ) Tj /F1 10 Tf 0 0 0 rg (will give you a ) Tj /F3 10 Tf 0 0 0 rg (ZeroDivisionError) Tj /F1 10 Tf 0 0 0 rg (, but since the function is decorated the traceback will) Tj T* 0 Tw (be longer:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 166.2236 cm
+1 0 0 1 62.69291 522.6236 cm
q
q
1 0 0 1 0 0 cm
@@ -5639,239 +6004,165 @@ n -6 -6 468.6898 120 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 96.75 12 12 re f*
+n 0 96 6 12 re f*
.960784 .960784 .862745 rg
-n 0 84.75 54 12 re f*
+n 6 96 6 12 re f*
.960784 .960784 .862745 rg
-n 60 84.75 6 12 re f*
+n 12 96 6 12 re f*
.960784 .960784 .862745 rg
-n 66 84.75 24 12 re f*
+n 24 96 6 12 re f*
.960784 .960784 .862745 rg
-n 96 84.75 36 12 re f*
+n 30 96 12 12 re f*
.960784 .960784 .862745 rg
-n 138 84.75 24 12 re f*
+n 0 84 54 12 re f*
.960784 .960784 .862745 rg
-n 168 84.75 24 12 re f*
+n 60 84 6 12 re f*
.960784 .960784 .862745 rg
-n 192 84.75 12 12 re f*
+n 66 84 24 12 re f*
.960784 .960784 .862745 rg
-n 12 72.75 18 12 re f*
+n 96 84 36 12 re f*
.960784 .960784 .862745 rg
-n 30 60.75 24 12 re f*
+n 138 84 24 12 re f*
.960784 .960784 .862745 rg
-n 60 60.75 6 12 re f*
+n 168 84 24 12 re f*
.960784 .960784 .862745 rg
-n 66 60.75 6 12 re f*
+n 192 84 12 12 re f*
.960784 .960784 .862745 rg
-n 72 60.75 36 12 re f*
+n 12 72 18 12 re f*
.960784 .960784 .862745 rg
-n 108 60.75 6 12 re f*
+n 30 60 24 12 re f*
.960784 .960784 .862745 rg
-n 114 60.75 6 12 re f*
+n 60 60 6 12 re f*
.960784 .960784 .862745 rg
-n 120 60.75 6 12 re f*
+n 66 60 6 12 re f*
.960784 .960784 .862745 rg
-n 132 60.75 24 12 re f*
+n 72 60 36 12 re f*
.960784 .960784 .862745 rg
-n 162 60.75 6 12 re f*
+n 108 60 6 12 re f*
.960784 .960784 .862745 rg
-n 168 60.75 6 12 re f*
+n 114 60 6 12 re f*
.960784 .960784 .862745 rg
-n 180 60.75 12 12 re f*
+n 120 60 6 12 re f*
.960784 .960784 .862745 rg
-n 198 60.75 6 12 re f*
+n 132 60 24 12 re f*
.960784 .960784 .862745 rg
-n 30 48.75 24 12 re f*
+n 162 60 6 12 re f*
.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
+n 168 60 6 12 re f*
.960784 .960784 .862745 rg
-n 66 48.75 6 12 re f*
+n 180 60 12 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 120 12 re f*
+n 198 60 6 12 re f*
.960784 .960784 .862745 rg
-n 192 48.75 6 12 re f*
+n 30 48 24 12 re f*
.960784 .960784 .862745 rg
-n 198 48.75 6 12 re f*
+n 60 48 6 12 re f*
.960784 .960784 .862745 rg
-n 204 48.75 6 12 re f*
+n 66 48 6 12 re f*
.960784 .960784 .862745 rg
-n 216 48.75 24 12 re f*
+n 72 48 120 12 re f*
.960784 .960784 .862745 rg
-n 246 48.75 6 12 re f*
+n 192 48 6 12 re f*
.960784 .960784 .862745 rg
-n 252 48.75 6 12 re f*
+n 198 48 6 12 re f*
.960784 .960784 .862745 rg
-n 264 48.75 12 12 re f*
+n 204 48 6 12 re f*
.960784 .960784 .862745 rg
-n 282 48.75 30 12 re f*
+n 216 48 24 12 re f*
.960784 .960784 .862745 rg
-n 42 36.75 36 12 re f*
+n 246 48 6 12 re f*
.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
+n 252 48 6 12 re f*
.960784 .960784 .862745 rg
-n 90 36.75 6 12 re f*
+n 264 48 12 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
+n 282 48 30 12 re f*
.960784 .960784 .862745 rg
-n 102 36.75 24 12 re f*
+n 42 36 36 12 re f*
.960784 .960784 .862745 rg
-n 126 36.75 6 12 re f*
+n 84 36 6 12 re f*
.960784 .960784 .862745 rg
-n 138 36.75 12 12 re f*
+n 90 36 6 12 re f*
.960784 .960784 .862745 rg
-n 150 36.75 12 12 re f*
+n 96 36 6 12 re f*
.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
+n 102 36 24 12 re f*
.960784 .960784 .862745 rg
-n 30 24.75 24 12 re f*
+n 126 36 6 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 138 36 12 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
+n 150 36 12 12 re f*
.960784 .960784 .862745 rg
-n 72 24.75 120 12 re f*
+n 162 36 6 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 6 12 re f*
+n 30 24 24 12 re f*
.960784 .960784 .862745 rg
-n 198 24.75 6 12 re f*
+n 60 24 6 12 re f*
.960784 .960784 .862745 rg
-n 204 24.75 6 12 re f*
+n 66 24 6 12 re f*
.960784 .960784 .862745 rg
-n 216 24.75 24 12 re f*
+n 72 24 120 12 re f*
.960784 .960784 .862745 rg
-n 246 24.75 6 12 re f*
+n 192 24 6 12 re f*
.960784 .960784 .862745 rg
-n 252 24.75 6 12 re f*
+n 198 24 6 12 re f*
.960784 .960784 .862745 rg
-n 264 24.75 12 12 re f*
+n 204 24 6 12 re f*
.960784 .960784 .862745 rg
-n 282 24.75 6 12 re f*
+n 216 24 24 12 re f*
.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
+n 246 24 6 12 re f*
.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
+n 252 24 6 12 re f*
.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
+n 264 24 12 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 102 12 re f*
+n 282 24 6 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
+n 42 12 6 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 42 12 re f*
+n 48 12 6 12 re f*
.960784 .960784 .862745 rg
-n 162 .75 48 12 re f*
+n 54 12 6 12 re f*
.960784 .960784 .862745 rg
-n 216 .75 12 12 re f*
+n 0 0 102 12 re f*
.960784 .960784 .862745 rg
-n 234 .75 36 12 re f*
+n 102 0 6 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 294 .75 24 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (string) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[18]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[47]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (ZeroDivisionError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (integer) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (division) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (or) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (modulo) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (by) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (zero) Tj T* ET
-Q
+n 114 0 18 12 re f*
+BT 1 0 0 1 0 98 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (string) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[22]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[51]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg T* /F5 10 Tf .823529 .254902 .227451 rg (ZeroDivisionError) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj T* ET
Q
Q
Q
Q
-q
-1 0 0 1 62.69291 98.22362 cm
-q
-BT 1 0 0 1 0 50 Tm 1.05528 Tw 12 TL /F1 10 Tf 0 0 0 rg (You see here the inner call to the decorator ) Tj /F4 10 Tf 0 0 0 rg (trace) Tj /F1 10 Tf 0 0 0 rg (, which calls ) Tj /F4 10 Tf 0 0 0 rg (f\(*args,) Tj ( ) Tj (**kw\)) Tj /F1 10 Tf 0 0 0 rg (, and a reference to) Tj T* 0 Tw .076457 Tw /F4 10 Tf 0 0 0 rg (File) Tj ( ) Tj (") Tj (<) Tj (string) Tj (>) Tj (",) Tj ( ) Tj (line) Tj ( ) Tj (2,) Tj ( ) Tj (in) Tj ( ) Tj (f) Tj /F1 10 Tf 0 0 0 rg (. This latter reference is due to the fact that internally the decorator) Tj T* 0 Tw 2.053318 Tw (module uses ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Notice that ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (is ) Tj /F5 10 Tf (not ) Tj /F1 10 Tf (responsibile for the) Tj T* 0 Tw 1.507485 Tw (performance penalty, since is the called ) Tj /F5 10 Tf (only once ) Tj /F1 10 Tf (at function decoration time, and not every time the) Tj T* 0 Tw (decorated function is called.) Tj T* ET
Q
-Q
-
-endstream
-endobj
-98 0 obj
-<< /Length 17293 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 693.0236 cm
+1 0 0 1 62.69291 454.6236 cm
q
-BT 1 0 0 1 0 62 Tm .932209 Tw 12 TL /F1 10 Tf 0 0 0 rg (At present, there is no clean way to avoid ) Tj /F4 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. A clean solution would require to change the CPython) Tj T* 0 Tw .777485 Tw (implementation of functions and add an hook to make it possible to change their signature directly. That) Tj T* 0 Tw .74186 Tw (could happen in future versions of Python \(see PEP ) Tj 0 0 .501961 rg (362) Tj 0 0 0 rg (\) and then the decorator module would become) Tj T* 0 Tw 2.385318 Tw (obsolete. However, at present, even in Python 3.1 it is impossible to change the function signature) Tj T* 0 Tw .931751 Tw (directly, therefore the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is still useful. Actually, this is one of the main reasons why I) Tj T* 0 Tw (keep maintaining the module and releasing new versions.) Tj T* ET
+BT 1 0 0 1 0 50 Tm 1.05528 Tw 12 TL /F1 10 Tf 0 0 0 rg (You see here the inner call to the decorator ) Tj /F3 10 Tf 0 0 0 rg (trace) Tj /F1 10 Tf 0 0 0 rg (, which calls ) Tj /F3 10 Tf 0 0 0 rg (f\(*args,) Tj ( ) Tj (**kw\)) Tj /F1 10 Tf 0 0 0 rg (, and a reference to) Tj T* 0 Tw .076457 Tw /F3 10 Tf 0 0 0 rg (File) Tj ( ) Tj (") Tj (<) Tj (string) Tj (>) Tj (",) Tj ( ) Tj (line) Tj ( ) Tj (2,) Tj ( ) Tj (in) Tj ( ) Tj (f) Tj /F1 10 Tf 0 0 0 rg (. This latter reference is due to the fact that internally the decorator) Tj T* 0 Tw 2.053318 Tw (module uses ) Tj /F3 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Notice that ) Tj /F3 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (is ) Tj /F4 10 Tf (not ) Tj /F1 10 Tf (responsibile for the) Tj T* 0 Tw 1.507485 Tw (performance penalty, since is the called ) Tj /F4 10 Tf (only once ) Tj /F1 10 Tf (at function decoration time, and not every time the) Tj T* 0 Tw (decorated function is called.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 627.0236 cm
+1 0 0 1 62.69291 376.6236 cm
q
-BT 1 0 0 1 0 50 Tm 1.043828 Tw 12 TL /F1 10 Tf 0 0 0 rg (In the present implementation, decorators generated by ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (can only be used on user-defined) Tj T* 0 Tw .152485 Tw (Python functions or methods, not on generic callable objects, nor on built-in functions, due to limitations of) Tj T* 0 Tw .591235 Tw (the ) Tj /F4 10 Tf 0 0 0 rg (inspect ) Tj /F1 10 Tf 0 0 0 rg (module in the standard library. Moreover, notice that you can decorate a method, but only) Tj T* 0 Tw 2.693516 Tw (before if becomes a bound or unbound method, i.e. inside the class. Here is an example of valid) Tj T* 0 Tw (decoration:) Tj T* ET
+BT 1 0 0 1 0 62 Tm .932209 Tw 12 TL /F1 10 Tf 0 0 0 rg (At present, there is no clean way to avoid ) Tj /F3 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. A clean solution would require to change the CPython) Tj T* 0 Tw .777485 Tw (implementation of functions and add an hook to make it possible to change their signature directly. That) Tj T* 0 Tw .74186 Tw (could happen in future versions of Python \(see PEP ) Tj 0 0 .501961 rg (362) Tj 0 0 0 rg (\) and then the decorator module would become) Tj T* 0 Tw 2.385318 Tw (obsolete. However, at present, even in Python 3.2 it is impossible to change the function signature) Tj T* 0 Tw .931751 Tw (directly, therefore the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is still useful. Actually, this is one of the main reasons why I) Tj T* 0 Tw (keep maintaining the module and releasing new versions.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 557.8236 cm
-q
-q
-1 0 0 1 0 0 cm
+1 0 0 1 62.69291 334.6236 cm
q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 108 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 102 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 24 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (C) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (meth) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
-Q
-Q
-Q
+BT 1 0 0 1 0 26 Tm 1.043828 Tw 12 TL /F1 10 Tf 0 0 0 rg (In the present implementation, decorators generated by ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (can only be used on user-defined) Tj T* 0 Tw .152485 Tw (Python functions or methods, not on generic callable objects, nor on built-in functions, due to limitations of) Tj T* 0 Tw (the ) Tj /F3 10 Tf 0 0 0 rg (inspect ) Tj /F1 10 Tf 0 0 0 rg (module in the standard library.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 537.8236 cm
+1 0 0 1 62.69291 304.6236 cm
q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of invalid decoration, when the decorator in called too late:) Tj T* ET
+BT 1 0 0 1 0 14 Tm .785777 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is a restriction on the names of the arguments: for instance, if try to call an argument ) Tj /F3 10 Tf 0 0 0 rg (_call_ ) Tj /F1 10 Tf 0 0 0 rg (or) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (_func_ ) Tj /F1 10 Tf 0 0 0 rg (you will get a ) Tj /F3 10 Tf 0 0 0 rg (NameError) Tj /F1 10 Tf 0 0 0 rg (:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 420.6236 cm
+1 0 0 1 62.69291 187.4236 cm
q
q
1 0 0 1 0 0 cm
@@ -5885,120 +6176,102 @@ n -6 -6 468.6898 108 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 60 84.75 6 12 re f*
+n 0 84 6 12 re f*
.960784 .960784 .862745 rg
-n 66 84.75 6 12 re f*
+n 6 84 6 12 re f*
.960784 .960784 .862745 rg
-n 72 84.75 36 12 re f*
+n 12 84 6 12 re f*
.960784 .960784 .862745 rg
-n 108 84.75 12 12 re f*
+n 24 84 36 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 0 72 18 12 re f*
.960784 .960784 .862745 rg
-n 54 72.75 18 12 re f*
+n 24 72 18 12 re f*
.960784 .960784 .862745 rg
-n 78 72.75 24 12 re f*
+n 48 72 6 12 re f*
.960784 .960784 .862745 rg
-n 102 72.75 6 12 re f*
+n 54 72 6 12 re f*
.960784 .960784 .862745 rg
-n 108 72.75 24 12 re f*
+n 60 72 36 12 re f*
.960784 .960784 .862745 rg
-n 132 72.75 12 12 re f*
+n 96 72 12 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
+n 114 72 30 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 24 12 re f*
+n 144 72 6 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
+n 150 72 6 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 156 72 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 0 60 18 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 0 48 54 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
+n 60 48 6 12 re f*
.960784 .960784 .862745 rg
-n 54 36.75 6 12 re f*
+n 66 48 24 12 re f*
.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
+n 96 48 36 12 re f*
.960784 .960784 .862745 rg
-n 66 36.75 6 12 re f*
+n 138 48 24 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 24 12 re f*
+n 168 48 24 12 re f*
.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
+n 192 48 12 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 54 12 re f*
+n 12 36 18 12 re f*
.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
+n 0 24 54 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 24 12 re f*
+n 54 24 6 12 re f*
.960784 .960784 .862745 rg
-n 96 24.75 36 12 re f*
+n 66 24 36 12 re f*
.960784 .960784 .862745 rg
-n 138 24.75 24 12 re f*
+n 108 24 12 12 re f*
.960784 .960784 .862745 rg
-n 168 24.75 24 12 re f*
+n 126 24 60 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 12 12 re f*
+n 192 24 12 12 re f*
.960784 .960784 .862745 rg
-n 12 12.75 18 12 re f*
+n 0 12 18 12 re f*
.960784 .960784 .862745 rg
-n 0 .75 54 12 re f*
+n 24 12 6 12 re f*
.960784 .960784 .862745 rg
-n 54 .75 6 12 re f*
+n 30 12 6 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 18 12 re f*
+n 36 12 36 12 re f*
.960784 .960784 .862745 rg
-n 90 .75 18 12 re f*
+n 72 12 12 12 re f*
.960784 .960784 .862745 rg
-n 114 .75 60 12 re f*
+n 24 0 36 12 re f*
.960784 .960784 .862745 rg
-n 180 .75 6 12 re f*
+n 66 0 36 12 re f*
.960784 .960784 .862745 rg
-n 192 .75 18 12 re f*
+n 102 0 6 12 re f*
.960784 .960784 .862745 rg
-n 216 .75 48 12 re f*
+n 108 0 36 12 re f*
.960784 .960784 .862745 rg
-n 264 .75 6 12 re f*
+n 144 0 6 12 re f*
.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
+n 156 0 36 12 re f*
.960784 .960784 .862745 rg
-n 282 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 330 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 372 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 378 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 384 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 408 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (C) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (meth) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (C) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (meth) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (TypeError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (You) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (are) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (decorating) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (a) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (non) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (function) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (<) Tj 0 0 0 rg (unbound) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (method) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (C) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (meth) Tj .4 .4 .4 rg (>) Tj T* ET
+n 192 0 6 12 re f*
+BT 1 0 0 1 0 86 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (print) Tj /F3 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F5 10 Tf .823529 .254902 .227451 rg (NameError) Tj /F3 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (is) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (overridden) Tj 0 0 0 rg ( ) Tj /F5 10 Tf .666667 .133333 1 rg (in) Tj /F3 10 Tf 0 0 0 rg T* /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F5 10 Tf 0 .501961 0 rg (return) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (_call_) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\)) Tj T* ET
Q
Q
Q
Q
Q
q
-1 0 0 1 62.69291 400.6236 cm
+1 0 0 1 62.69291 167.4236 cm
q
0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The solution is to extract the inner function from the unbound method:) Tj T* ET
+BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Finally, the implementation is such that the decorated function shares the original function dictionary:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 355.4236 cm
+1 0 0 1 62.69291 86.22362 cm
q
q
1 0 0 1 0 0 cm
@@ -6008,165 +6281,96 @@ q
.662745 .662745 .662745 RG
.5 w
.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 12.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 144 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 108 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (C) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (meth) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (im_func) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (function) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (meth) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (at) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (...) Tj (>) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 323.4236 cm
-q
-BT 1 0 0 1 0 14 Tm .785777 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is a restriction on the names of the arguments: for instance, if try to call an argument ) Tj /F4 10 Tf 0 0 0 rg (_call_ ) Tj /F1 10 Tf 0 0 0 rg (or) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (_func_ ) Tj /F1 10 Tf 0 0 0 rg (you will get a ) Tj /F4 10 Tf 0 0 0 rg (NameError) Tj /F1 10 Tf 0 0 0 rg (:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 206.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
+n -6 -6 468.6898 72 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 84.75 36 12 re f*
+n 24 48 18 12 re f*
.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
+n 48 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
+n 54 48 18 12 re f*
.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
+n 78 48 24 12 re f*
.960784 .960784 .862745 rg
-n 54 72.75 6 12 re f*
+n 108 48 138 12 re f*
.960784 .960784 .862745 rg
-n 60 72.75 36 12 re f*
+n 0 36 6 12 re f*
.960784 .960784 .862745 rg
-n 96 72.75 12 12 re f*
+n 6 36 6 12 re f*
.960784 .960784 .862745 rg
-n 114 72.75 30 12 re f*
+n 12 36 6 12 re f*
.960784 .960784 .862745 rg
-n 150 72.75 6 12 re f*
+n 24 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
+n 30 36 6 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 54 12 re f*
+n 36 36 30 12 re f*
.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
+n 72 36 6 12 re f*
.960784 .960784 .862745 rg
-n 66 48.75 24 12 re f*
+n 84 36 66 12 re f*
.960784 .960784 .862745 rg
-n 96 48.75 36 12 re f*
+n 156 36 132 12 re f*
.960784 .960784 .862745 rg
-n 138 48.75 24 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 168 48.75 24 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 192 48.75 12 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 18 12 re f*
+n 24 24 6 12 re f*
.960784 .960784 .862745 rg
-n 0 24.75 54 12 re f*
+n 30 24 6 12 re f*
.960784 .960784 .862745 rg
-n 54 24.75 6 12 re f*
+n 36 24 30 12 re f*
.960784 .960784 .862745 rg
-n 66 24.75 36 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 108 24.75 12 12 re f*
+n 84 24 96 12 re f*
.960784 .960784 .862745 rg
-n 126 24.75 60 12 re f*
+n 186 24 162 12 re f*
.960784 .960784 .862745 rg
-n 192 24.75 12 12 re f*
+n 0 0 6 12 re f*
.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
+n 6 0 6 12 re f*
.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
+n 12 0 6 12 re f*
.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
+n 24 0 48 12 re f*
.960784 .960784 .862745 rg
-n 36 12.75 36 12 re f*
+n 78 0 6 12 re f*
.960784 .960784 .862745 rg
-n 72 12.75 12 12 re f*
+n 90 0 30 12 re f*
.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
+n 120 0 6 12 re f*
.960784 .960784 .862745 rg
-n 66 .75 36 12 re f*
+n 126 0 6 12 re f*
.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
+n 132 0 6 12 re f*
.960784 .960784 .862745 rg
-n 108 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (NameError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (is) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (overridden) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (_call_) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\)) Tj T* ET
-Q
+n 144 0 144 12 re f*
+BT 1 0 0 1 0 50 Tm 12 TL /F3 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (def) Tj /F3 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F5 10 Tf 0 .501961 0 rg (pass) Tj /F3 10 Tf 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original function) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting an attribute) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something else") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting another attribute) Tj /F3 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the decorated function) Tj /F3 10 Tf 0 0 0 rg T* ET
Q
Q
Q
Q
-q
-1 0 0 1 62.69291 174.2236 cm
-q
-BT 1 0 0 1 0 14 Tm .194651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Finally, the implementation is such that the decorated function attribute ) Tj /F4 10 Tf 0 0 0 rg (.func_globals ) Tj /F1 10 Tf 0 0 0 rg (is a ) Tj /F5 10 Tf (copy ) Tj /F1 10 Tf (of the) Tj T* 0 Tw (original function attribute, just as the attribute dictionary of the decorated function.) Tj T* ET
-Q
Q
+
+endstream
+endobj
+110 0 obj
+<< /Length 8299 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 81.02362 cm
+1 0 0 1 62.69291 679.8236 cm
q
q
1 0 0 1 0 0 cm
@@ -6180,201 +6384,140 @@ n -6 -6 468.6898 84 re B*
Q
q
.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
+n 0 48 6 12 re f*
.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
+n 6 48 6 12 re f*
.960784 .960784 .862745 rg
-n 24 60.75 18 12 re f*
+n 12 48 6 12 re f*
.960784 .960784 .862745 rg
-n 48 60.75 6 12 re f*
+n 24 48 48 12 re f*
.960784 .960784 .862745 rg
-n 54 60.75 18 12 re f*
+n 72 48 6 12 re f*
.960784 .960784 .862745 rg
-n 78 60.75 24 12 re f*
+n 78 48 30 12 re f*
.960784 .960784 .862745 rg
-n 108 60.75 138 12 re f*
+n 0 36 66 12 re f*
.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
+n 0 24 6 12 re f*
.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
+n 6 24 6 12 re f*
.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
+n 12 24 6 12 re f*
.960784 .960784 .862745 rg
-n 24 48.75 6 12 re f*
+n 24 24 48 12 re f*
.960784 .960784 .862745 rg
-n 30 48.75 6 12 re f*
+n 72 24 6 12 re f*
.960784 .960784 .862745 rg
-n 36 48.75 30 12 re f*
+n 78 24 30 12 re f*
.960784 .960784 .862745 rg
-n 72 48.75 6 12 re f*
+n 114 24 6 12 re f*
.960784 .960784 .862745 rg
-n 84 48.75 66 12 re f*
+n 126 24 126 12 re f*
.960784 .960784 .862745 rg
-n 156 48.75 132 12 re f*
+n 258 24 84 12 re f*
.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
+n 0 12 6 12 re f*
.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
+n 6 12 6 12 re f*
.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
+n 12 12 6 12 re f*
.960784 .960784 .862745 rg
-n 24 36.75 6 12 re f*
+n 24 12 6 12 re f*
.960784 .960784 .862745 rg
-n 30 36.75 6 12 re f*
+n 30 12 6 12 re f*
.960784 .960784 .862745 rg
-n 36 36.75 30 12 re f*
+n 36 12 30 12 re f*
.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
+n 72 12 234 12 re f*
.960784 .960784 .862745 rg
-n 84 36.75 96 12 re f*
-.960784 .960784 .862745 rg
-n 186 36.75 162 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 12.75 144 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original function) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting an attribute) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something else") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting another attribute) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the decorated function) Tj /F4 10 Tf 0 0 0 rg T* T* ET
+n 0 0 96 12 re f*
+BT 1 0 0 1 0 62 Tm 12 TL /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('something') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something different") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting attr) Tj /F3 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original attribute did not change) Tj /F3 10 Tf 0 0 0 rg T* .729412 .129412 .129412 rg ('something else') Tj T* ET
Q
Q
Q
Q
Q
-
-endstream
-endobj
-99 0 obj
-<< /Length 6500 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 691.8236 cm
+1 0 0 1 62.69291 646.8236 cm
q
+BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Compatibility notes) Tj T* ET
+Q
+Q
q
-1 0 0 1 0 0 cm
+1 0 0 1 62.69291 604.8236 cm
q
-1 0 0 1 6.6 6.6 cm
+0 0 0 rg
+BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 1.344988 Tw (This version supports all Python releases from 2.6 to 3.5 with a single code base. In order to do so, I) Tj T* 0 Tw .332093 Tw (decided to drop the support for ancient versions of Python \(Python 2.5 is nearly ten year old\). If you need) Tj T* 0 Tw (to support ancient versions of Python, stick with the decorator module 3.4.1.) Tj T* ET
+Q
+Q
q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 72 re B*
+1 0 0 1 62.69291 571.8236 cm
+q
+BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Historical notes) Tj T* ET
+Q
Q
q
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 114 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 126 12 re f*
-.960784 .960784 .862745 rg
-n 264 24.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 234 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 96 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('something') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something different") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting attr) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original attribute did not change) Tj /F4 10 Tf 0 0 0 rg T* .729412 .129412 .129412 rg ('something else') Tj T* ET
+1 0 0 1 62.69291 553.8236 cm
+q
+0 0 0 rg
+BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The decorator module is over ten years old. Here a few notes on its evolution, for whoever is interested.) Tj T* ET
Q
Q
+q
+1 0 0 1 62.69291 487.8236 cm
+q
+BT 1 0 0 1 0 50 Tm 1.864987 Tw 12 TL /F1 10 Tf 0 0 0 rg (Version 3.4 fixes some bugs in the support of recent versions of Python 3. Version 3.3 was the first) Tj T* 0 Tw .770697 Tw (version of the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module to fully support Python 3, including ) Tj 0 0 .501961 rg (function annotations) Tj 0 0 0 rg (. Version 3.2) Tj T* 0 Tw .452093 Tw (was the first version to support Python 3 via the ) Tj /F3 10 Tf 0 0 0 rg (2to3 ) Tj /F1 10 Tf 0 0 0 rg (conversion tool. The hard work \(for me\) has been) Tj T* 0 Tw 2.514983 Tw (converting the documentation and the doctests. This has been possible only after that ) Tj 0 0 .501961 rg (docutils ) Tj 0 0 0 rg (and) Tj T* 0 Tw 0 0 .501961 rg (pygments ) Tj 0 0 0 rg (have been ported to Python 3.) Tj T* ET
Q
Q
+q
+1 0 0 1 62.69291 409.8236 cm
+q
+BT 1 0 0 1 0 62 Tm .793984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Version 3 of the ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module do not contain any backward incompatible change, apart from the) Tj T* 0 Tw 3.63498 Tw (removal of the functions ) Tj /F3 10 Tf 0 0 0 rg (get_info ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F3 10 Tf 0 0 0 rg (new_wrapper) Tj /F1 10 Tf 0 0 0 rg (, which have been deprecated for years.) Tj T* 0 Tw .293672 Tw /F3 10 Tf 0 0 0 rg (get_info ) Tj /F1 10 Tf 0 0 0 rg (has been removed since it was little used and since it had to be changed anyway to work with) Tj T* 0 Tw 2.298555 Tw (Python 3.0; ) Tj /F3 10 Tf 0 0 0 rg (new_wrapper ) Tj /F1 10 Tf 0 0 0 rg (has been removed since it was useless: its major use case \(converting) Tj T* 0 Tw 7.136976 Tw (signature changing decorators to signature preserving decorators\) has been subsumed by) Tj T* 0 Tw /F3 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (, whereas the other use case can be managed with the ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
+Q
Q
q
-1 0 0 1 62.69291 658.8236 cm
+1 0 0 1 62.69291 367.8236 cm
q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Compatibility notes) Tj T* ET
+BT 1 0 0 1 0 26 Tm 1.329213 Tw 12 TL /F1 10 Tf 0 0 0 rg (There are a few changes in the documentation: I removed the ) Tj /F3 10 Tf 0 0 0 rg (decorator_factory ) Tj /F1 10 Tf 0 0 0 rg (example, which) Tj T* 0 Tw 2.562927 Tw (was confusing some of my users, and I removed the part about exotic signatures in the Python 3) Tj T* 0 Tw (documentation, since Python 3 does not support them.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 604.8236 cm
+1 0 0 1 62.69291 301.8236 cm
q
-BT 1 0 0 1 0 38 Tm 1.831984 Tw 12 TL /F1 10 Tf 0 0 0 rg (This version fully supports Python 3, including ) Tj 0 0 .501961 rg (function annotations) Tj 0 0 0 rg (. Moreover it is the first version to) Tj T* 0 Tw 4.83748 Tw (support generic callers, i.e. callable objects with the right signature, not necessarily functions.) Tj T* 0 Tw .70436 Tw /F4 10 Tf 0 0 0 rg (contextmanager ) Tj /F1 10 Tf 0 0 0 rg (will not work in Python 2.4. The decorated function dictionary is now the same of the) Tj T* 0 Tw (original function dictionary, wheread in past versions they were different objects.) Tj T* ET
+BT 1 0 0 1 0 50 Tm .942651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Finally ) Tj /F3 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (cannot be used as a class decorator and the ) Tj 0 0 .501961 rg (functionality introduced in version 2.3) Tj T* 0 Tw .241163 Tw 0 0 0 rg (has been removed. That means that in order to define decorator factories with classes you need to define) Tj T* 0 Tw 1.122126 Tw (the ) Tj /F3 10 Tf 0 0 0 rg (__call__ ) Tj /F1 10 Tf 0 0 0 rg (method explicitly \(no magic anymore\). All these changes should not cause any trouble,) Tj T* 0 Tw .601163 Tw (since they were all rarely used features. Should you have any trouble, you can always downgrade to the) Tj T* 0 Tw (2.3 version.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 538.8236 cm
+1 0 0 1 62.69291 235.8236 cm
q
-BT 1 0 0 1 0 50 Tm .936654 Tw 12 TL /F1 10 Tf 0 0 0 rg (The examples shown here have been tested with Python 2.7 and 3.4. Python 2.4 is also supported - of) Tj T* 0 Tw .734104 Tw (course the examples requiring the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement will not work there. Python 2.5 works fine, but if you) Tj T* 0 Tw 2.409983 Tw (run the examples in the interactive interpreter you will notice a few differences since ) Tj /F4 10 Tf 0 0 0 rg (getargspec) Tj T* 0 Tw 4.486412 Tw /F1 10 Tf 0 0 0 rg (returns an ) Tj /F4 10 Tf 0 0 0 rg (ArgSpec ) Tj /F1 10 Tf 0 0 0 rg (namedtuple instead of a regular tuple. That means that running the file) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (documentation.py ) Tj /F1 10 Tf 0 0 0 rg (under Python 2.5 will print a few errors, but they are not serious.) Tj T* ET
+BT 1 0 0 1 0 50 Tm .196098 Tw 12 TL /F1 10 Tf 0 0 0 rg (The examples shown here have been tested with Python 2.6. Python 2.4 is also supported - of course the) Tj T* 0 Tw 1.649398 Tw (examples requiring the ) Tj /F3 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement will not work there. Python 2.5 works fine, but if you run the) Tj T* 0 Tw 1.41784 Tw (examples in the interactive interpreter you will notice a few differences since ) Tj /F3 10 Tf 0 0 0 rg (getargspec ) Tj /F1 10 Tf 0 0 0 rg (returns an) Tj T* 0 Tw .909982 Tw /F3 10 Tf 0 0 0 rg (ArgSpec ) Tj /F1 10 Tf 0 0 0 rg (namedtuple instead of a regular tuple. That means that running the file ) Tj /F3 10 Tf 0 0 0 rg (documentation.py) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (under Python 2.5 will print a few errors, but they are not serious.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 505.8236 cm
+1 0 0 1 62.69291 202.8236 cm
q
BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (LICENCE) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 487.8236 cm
+1 0 0 1 62.69291 184.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Copyright \(c\) 2005-2015, Michele Simionato All rights reserved.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 457.8236 cm
+1 0 0 1 62.69291 154.8236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.328555 Tw (Redistribution and use in source and binary forms, with or without modification, are permitted provided) Tj T* 0 Tw (that the following conditions are met:) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 451.8236 cm
+1 0 0 1 62.69291 148.8236 cm
Q
q
-1 0 0 1 62.69291 403.8236 cm
+1 0 0 1 62.69291 100.8236 cm
0 0 0 rg
BT /F1 10 Tf 12 TL ET
BT 1 0 0 1 0 2 Tm T* ET
@@ -6389,17 +6532,24 @@ q
Q
Q
q
-1 0 0 1 62.69291 403.8236 cm
+1 0 0 1 62.69291 100.8236 cm
Q
+
+endstream
+endobj
+111 0 obj
+<< /Length 1444 >>
+stream
+1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q
-1 0 0 1 62.69291 277.8236 cm
+1 0 0 1 62.69291 645.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 110 Tm /F1 10 Tf 12 TL .17998 Tw (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND) Tj T* 0 Tw 2.911797 Tw (ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED) Tj T* 0 Tw 5.165529 Tw (WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE) Tj T* 0 Tw 1.395433 Tw (DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE) Tj T* 0 Tw 5.53122 Tw (FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL) Tj T* 0 Tw 2.705976 Tw (DAMAGES \(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR) Tj T* 0 Tw 3.868976 Tw (SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\) HOWEVER) Tj T* 0 Tw 1.326647 Tw (CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR) Tj T* 0 Tw 1.525366 Tw (TORT \(INCLUDING NEGLIGENCE OR OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE OF) Tj T* 0 Tw (THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.) Tj T* ET
Q
Q
q
-1 0 0 1 62.69291 247.8236 cm
+1 0 0 1 62.69291 615.0236 cm
q
0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .407132 Tw (If you use this software and you are happy with it, consider sending me a note, just to gratify my ego. On) Tj T* 0 Tw (the other hand, if you use this software and you are unhappy with it, send me a patch!) Tj T* ET
@@ -6408,179 +6558,196 @@ Q
endstream
endobj
-100 0 obj
-<< /Nums [ 0 101 0 R 1 102 0 R 2 103 0 R 3 104 0 R 4 105 0 R
- 5 106 0 R 6 107 0 R 7 108 0 R 8 109 0 R 9 110 0 R
- 10 111 0 R 11 112 0 R 12 113 0 R 13 114 0 R 14 115 0 R ] >>
+112 0 obj
+<< /Nums [ 0 113 0 R 1 114 0 R 2 115 0 R 3 116 0 R 4 117 0 R
+ 5 118 0 R 6 119 0 R 7 120 0 R 8 121 0 R 9 122 0 R
+ 10 123 0 R 11 124 0 R 12 125 0 R 13 126 0 R 14 127 0 R
+ 15 128 0 R ] >>
endobj
-101 0 obj
+113 0 obj
<< /S /D /St 1 >>
endobj
-102 0 obj
+114 0 obj
<< /S /D /St 2 >>
endobj
-103 0 obj
+115 0 obj
<< /S /D /St 3 >>
endobj
-104 0 obj
+116 0 obj
<< /S /D /St 4 >>
endobj
-105 0 obj
+117 0 obj
<< /S /D /St 5 >>
endobj
-106 0 obj
+118 0 obj
<< /S /D /St 6 >>
endobj
-107 0 obj
+119 0 obj
<< /S /D /St 7 >>
endobj
-108 0 obj
+120 0 obj
<< /S /D /St 8 >>
endobj
-109 0 obj
+121 0 obj
<< /S /D /St 9 >>
endobj
-110 0 obj
+122 0 obj
<< /S /D /St 10 >>
endobj
-111 0 obj
+123 0 obj
<< /S /D /St 11 >>
endobj
-112 0 obj
+124 0 obj
<< /S /D /St 12 >>
endobj
-113 0 obj
+125 0 obj
<< /S /D /St 13 >>
endobj
-114 0 obj
+126 0 obj
<< /S /D /St 14 >>
endobj
-115 0 obj
+127 0 obj
<< /S /D /St 15 >>
endobj
+128 0 obj
+<< /S /D /St 16 >>
+endobj
xref
-0 116
+0 129
0000000000 65535 f
0000000075 00000 n
-0000000161 00000 n
-0000000271 00000 n
-0000000386 00000 n
-0000000499 00000 n
-0000000688 00000 n
-0000000886 00000 n
-0000000994 00000 n
-0000001165 00000 n
-0000001336 00000 n
-0000001508 00000 n
-0000001680 00000 n
-0000001852 00000 n
-0000002024 00000 n
-0000002196 00000 n
-0000002368 00000 n
-0000002540 00000 n
-0000002712 00000 n
-0000002884 00000 n
-0000003056 00000 n
-0000003228 00000 n
-0000003400 00000 n
-0000003572 00000 n
-0000003744 00000 n
-0000003916 00000 n
-0000004088 00000 n
-0000004260 00000 n
-0000004432 00000 n
-0000004604 00000 n
-0000004776 00000 n
-0000004948 00000 n
-0000005120 00000 n
-0000005292 00000 n
-0000005464 00000 n
-0000005636 00000 n
-0000005808 00000 n
-0000005980 00000 n
-0000006152 00000 n
-0000006324 00000 n
-0000006496 00000 n
-0000006668 00000 n
-0000006840 00000 n
-0000007012 00000 n
-0000007501 00000 n
-0000007620 00000 n
-0000007825 00000 n
-0000007942 00000 n
-0000008169 00000 n
-0000008405 00000 n
-0000008615 00000 n
-0000008825 00000 n
-0000009035 00000 n
-0000009245 00000 n
-0000009455 00000 n
-0000009665 00000 n
-0000009875 00000 n
-0000010085 00000 n
-0000010276 00000 n
-0000010494 00000 n
-0000010730 00000 n
-0000010940 00000 n
-0000011150 00000 n
-0000011345 00000 n
-0000011574 00000 n
-0000011770 00000 n
-0000011999 00000 n
-0000012109 00000 n
-0000012357 00000 n
-0000012435 00000 n
-0000012552 00000 n
-0000012681 00000 n
-0000012823 00000 n
-0000012953 00000 n
-0000013088 00000 n
-0000013230 00000 n
-0000013356 00000 n
-0000013479 00000 n
+0000000162 00000 n
+0000000272 00000 n
+0000000387 00000 n
+0000000495 00000 n
+0000000684 00000 n
+0000000882 00000 n
+0000001053 00000 n
+0000001224 00000 n
+0000001395 00000 n
+0000001567 00000 n
+0000001739 00000 n
+0000001911 00000 n
+0000002083 00000 n
+0000002255 00000 n
+0000002427 00000 n
+0000002599 00000 n
+0000002771 00000 n
+0000002943 00000 n
+0000003115 00000 n
+0000003287 00000 n
+0000003459 00000 n
+0000003631 00000 n
+0000003803 00000 n
+0000003975 00000 n
+0000004147 00000 n
+0000004319 00000 n
+0000004491 00000 n
+0000004663 00000 n
+0000004835 00000 n
+0000005007 00000 n
+0000005179 00000 n
+0000005351 00000 n
+0000005523 00000 n
+0000005695 00000 n
+0000005867 00000 n
+0000006039 00000 n
+0000006211 00000 n
+0000006383 00000 n
+0000006555 00000 n
+0000006727 00000 n
+0000006899 00000 n
+0000007071 00000 n
+0000007243 00000 n
+0000007415 00000 n
+0000007587 00000 n
+0000008107 00000 n
+0000008226 00000 n
+0000008431 00000 n
+0000008545 00000 n
+0000008662 00000 n
+0000008891 00000 n
+0000009118 00000 n
+0000009347 00000 n
+0000009557 00000 n
+0000009753 00000 n
+0000009983 00000 n
+0000010194 00000 n
+0000010405 00000 n
+0000010616 00000 n
+0000010827 00000 n
+0000011038 00000 n
+0000011229 00000 n
+0000011459 00000 n
+0000011677 00000 n
+0000011907 00000 n
+0000012118 00000 n
+0000012313 00000 n
+0000012543 00000 n
+0000012739 00000 n
+0000012927 00000 n
+0000013103 00000 n
+0000013360 00000 n
0000013611 00000 n
-0000013752 00000 n
-0000013893 00000 n
-0000014046 00000 n
-0000014187 00000 n
-0000014324 00000 n
-0000014436 00000 n
-0000014603 00000 n
-0000023769 00000 n
-0000036376 00000 n
-0000053623 00000 n
-0000069507 00000 n
-0000091890 00000 n
-0000110195 00000 n
-0000126839 00000 n
-0000144261 00000 n
-0000158122 00000 n
-0000171904 00000 n
-0000185676 00000 n
-0000202654 00000 n
-0000213129 00000 n
-0000230480 00000 n
-0000237037 00000 n
-0000237236 00000 n
-0000237274 00000 n
-0000237312 00000 n
-0000237350 00000 n
-0000237388 00000 n
-0000237426 00000 n
-0000237464 00000 n
-0000237502 00000 n
-0000237540 00000 n
-0000237578 00000 n
-0000237617 00000 n
-0000237656 00000 n
-0000237695 00000 n
-0000237734 00000 n
-0000237773 00000 n
+0000013822 00000 n
+0000013932 00000 n
+0000014180 00000 n
+0000014258 00000 n
+0000014375 00000 n
+0000014504 00000 n
+0000014646 00000 n
+0000014776 00000 n
+0000014911 00000 n
+0000015049 00000 n
+0000015191 00000 n
+0000015317 00000 n
+0000015440 00000 n
+0000015572 00000 n
+0000015713 00000 n
+0000015854 00000 n
+0000016007 00000 n
+0000016148 00000 n
+0000016285 00000 n
+0000016419 00000 n
+0000016531 00000 n
+0000016705 00000 n
+0000025992 00000 n
+0000038042 00000 n
+0000054086 00000 n
+0000072110 00000 n
+0000092892 00000 n
+0000111589 00000 n
+0000125155 00000 n
+0000144433 00000 n
+0000159083 00000 n
+0000173494 00000 n
+0000187737 00000 n
+0000204096 00000 n
+0000211849 00000 n
+0000228667 00000 n
+0000237024 00000 n
+0000238526 00000 n
+0000238740 00000 n
+0000238778 00000 n
+0000238816 00000 n
+0000238854 00000 n
+0000238892 00000 n
+0000238930 00000 n
+0000238968 00000 n
+0000239006 00000 n
+0000239044 00000 n
+0000239082 00000 n
+0000239121 00000 n
+0000239160 00000 n
+0000239199 00000 n
+0000239238 00000 n
+0000239277 00000 n
+0000239316 00000 n
trailer
<< /ID
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
- [(SU\214\363\250\006M\005\356\362\\\343\)\352\220A) (SU\214\363\250\006M\005\356\362\\\343\)\352\220A)]
- /Info 67 0 R /Root 66 0 R /Size 116 >>
+ [(\007\216\355\362\015x\310:\337\005\351U/8-") (\007\216\355\362\015x\310:\337\005\351U/8-")]
+ /Info 76 0 R /Root 75 0 R /Size 129 >>
startxref
-237812
+239355
%%EOF
diff --git a/documentation.py b/documentation.py
index 9f5c111..f472b4e 100644
--- a/documentation.py
+++ b/documentation.py
@@ -1,13 +1,15 @@
-r"""
+from __future__ import print_function
+
+doc = r"""
The ``decorator`` module
=============================================================
:Author: Michele Simionato
:E-mail: michele.simionato@gmail.com
:Version: $VERSION ($DATE)
-:Requires: Python 2.4+
+:Requires: Python 2.6+
:Download page: http://pypi.python.org/pypi/decorator/$VERSION
-:Installation: ``easy_install decorator``
+:Installation: ``pip install decorator``
:License: BSD license
.. contents::
@@ -95,7 +97,7 @@ been added in Python 2.5 expressly to simplify the definition of decorators
``__name__``, ``__doc__``, ``__module__`` and ``__dict__``
from the original function to the decorated function by hand).
-.. _functools.update_wrapper: https://docs.python.org/2/library/functools.html#functools.update_wrapper
+.. _functools.update_wrapper: https://docs.python.org/3/library/functools.html#functools.update_wrapper
The implementation above works in the sense that the decorator
can accept functions with generic signatures; unfortunately this
@@ -119,7 +121,7 @@ keyword arguments:
.. code-block:: python
>>> from inspect import getargspec
- >>> print getargspec(f1) # I am using Python 2.6+ here
+ >>> print(getargspec(f1))
ArgSpec(args=[], varargs='args', keywords='kw', defaults=None)
This means that introspection tools such as pydoc will give
@@ -130,10 +132,10 @@ argument, you will get an error:
.. code-block:: python
- >>> f1(0, 1)
+ >>> f1(0, 1) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
- TypeError: f1() takes exactly 1 argument (2 given)
+ TypeError: f1() takes exactly 1 positional argument (2 given)
The solution
-----------------------------------------
@@ -175,17 +177,17 @@ Here is a test of usage:
... time.sleep(2)
... return "done"
- >>> print heavy_computation() # the first time it will take 2 seconds
+ >>> print(heavy_computation()) # the first time it will take 2 seconds
done
- >>> print heavy_computation() # the second time it will be instantaneous
+ >>> print(heavy_computation()) # the second time it will be instantaneous
done
The signature of ``heavy_computation`` is the one you would expect:
.. code-block:: python
- >>> print getargspec(heavy_computation)
+ >>> print(getargspec(heavy_computation))
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
A ``trace`` decorator
@@ -202,7 +204,7 @@ $$trace
Here is an example of usage:
.. code-block:: python
-
+
>>> @trace
... def f1(x):
... pass
@@ -218,7 +220,7 @@ and it that it has the correct signature:
.. code-block:: python
- >>> print getargspec(f1)
+ >>> print(getargspec(f1))
ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
The same decorator works with functions of any signature:
@@ -232,24 +234,10 @@ The same decorator works with functions of any signature:
>>> f(0, 3)
calling f with args (0, 3, 2), {}
- >>> print getargspec(f)
+ >>> print(getargspec(f))
ArgSpec(args=['x', 'y', 'z'], varargs='args', keywords='kw', defaults=(1, 2))
-That includes even functions with exotic signatures like the following:
-
-.. code-block:: python
-
- >>> @trace
- ... def exotic_signature((x, y)=(1,2)): return x+y
-
- >>> print getargspec(exotic_signature)
- ArgSpec(args=[['x', 'y']], varargs=None, keywords=None, defaults=((1, 2),))
- >>> exotic_signature()
- calling exotic_signature with args ((1, 2),), {}
- 3
-
-Notice that the support for exotic signatures has been deprecated
-in Python 2.6 and removed in Python 3.0.
+$FUNCTION_ANNOTATIONS
``decorator`` is a decorator
---------------------------------------------
@@ -272,7 +260,8 @@ For instance, you can write directly
>>> @decorator
... def trace(f, *args, **kw):
- ... print "calling %s with args %s, %s" % (f.func_name, args, kw)
+ ... kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
+ ... print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
... return f(*args, **kw)
and now ``trace`` will be a decorator. Actually ``trace`` is a ``partial``
@@ -318,19 +307,19 @@ available. For instance:
... time.sleep(3) # simulate a blocking resource
... return "some data"
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
>>> time.sleep(1)
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
>>> time.sleep(1)
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
- >>> time.sleep(1.1) # after 3.1 seconds, data is available
- >>> print read_data()
+ >>> time.sleep(1.1) # after 3.1 seconds, data is available
+ >>> print(read_data())
some data
``async``
@@ -356,9 +345,9 @@ $$on_failure
$$on_closing
$$Async
-The decorated function returns the current execution thread, which can
-be stored and checked later, for instance to verify that the
-thread ``.isAlive()``.
+The decorated function returns
+the current execution thread, which can be stored and checked later, for
+instance to verify that the thread ``.isAlive()``.
Here is an example of usage. Suppose one wants to write some data to
an external resource which can be accessed by a single user at once
@@ -386,23 +375,23 @@ be no synchronization problems since ``write`` is locked.
>>> write("data1") # doctest: +ELLIPSIS
<Thread(write-1, started...)>
-
+
>>> time.sleep(.1) # wait a bit, so we are sure data2 is written after data1
-
+
>>> write("data2") # doctest: +ELLIPSIS
<Thread(write-2, started...)>
-
+
>>> time.sleep(2) # wait for the writers to complete
-
- >>> print datalist
+
+ >>> print(datalist)
['data1', 'data2']
contextmanager
-------------------------------------
For a long time Python had in its standard library a ``contextmanager``
-decorator, able to convert generator functions into ``GeneratorContextManager``
-factories. For instance if you write
+decorator, able to convert generator functions into
+``GeneratorContextManager`` factories. For instance if you write
.. code-block:: python
@@ -420,11 +409,8 @@ the ``with`` statement:
.. code-block:: python
- >>> ba = before_after('BEFORE', 'AFTER')
- >>> type(ba)
- <class 'contextlib.GeneratorContextManager'>
- >>> with ba:
- ... print 'hello'
+ >>> with before_after('BEFORE', 'AFTER'):
+ ... print('hello')
BEFORE
hello
AFTER
@@ -439,7 +425,7 @@ method, so that they can be used as decorators as in this example:
>>> @ba # doctest: +SKIP
... def hello():
- ... print 'hello'
+ ... print('hello')
...
>>> hello() # doctest: +SKIP
BEFORE
@@ -462,10 +448,6 @@ will returns instances of ``ContextManager``, a subclass of
``contextlib.GeneratorContextManager`` with a ``__call__`` method
acting as a signature-preserving decorator.
-**Disclaimer**: the ``contextmanager`` decorator is an *experimental* feature:
-it may go away in future versions of the decorator module. Use it at your
-own risk.
-
The ``FunctionMaker`` class
---------------------------------------------------------------
@@ -486,7 +468,7 @@ were the function is generated by ``exec``. Here is an example:
.. code-block:: python
>>> def f(*args, **kw): # a function with a generic signature
- ... print args, kw
+ ... print(args, kw)
>>> f1 = FunctionMaker.create('f1(a, b)', 'f(a, b)', dict(f=f))
>>> f1(1,2)
@@ -509,7 +491,7 @@ be added to the generated function:
>>> f1 = FunctionMaker.create(
... 'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True)
- >>> print f1.__source__
+ >>> print(f1.__source__)
def f1(a, b):
f(a, b)
<BLANKLINE>
@@ -563,7 +545,8 @@ $$identity_dec
@identity_dec
def example(): pass
- >>> print inspect.getsource(example)
+ >>> import inspect
+ >>> print(inspect.getsource(example))
def wrapper(*args, **kw):
return func(*args, **kw)
<BLANKLINE>
@@ -578,7 +561,7 @@ undecorated function:
.. code-block:: python
- >>> print inspect.getsource(factorial.__wrapped__)
+ >>> print(inspect.getsource(factorial.__wrapped__))
@tail_recursive
def factorial(n, acc=1):
"The good old factorial"
@@ -630,7 +613,7 @@ $$factorial
.. code-block:: python
- >>> print factorial(4)
+ >>> print(factorial(4))
24
This decorator is pretty impressive, and should give you some food for
@@ -653,7 +636,7 @@ have a performance penalty.
The worse case is shown by the following example::
$ cat performance.sh
- python -m timeit -s "
+ python3 -m timeit -s "
from decorator import decorator
@decorator
@@ -665,7 +648,7 @@ The worse case is shown by the following example::
pass
" "f()"
- python -m timeit -s "
+ python3 -m timeit -s "
def f():
pass
" "f()"
@@ -674,8 +657,8 @@ On my MacBook, using the ``do_nothing`` decorator instead of the
plain function is more than three times slower::
$ bash performance.sh
- 1000000 loops, best of 3: 0.995 usec per loop
- 1000000 loops, best of 3: 0.273 usec per loop
+ 1000000 loops, best of 3: 0.669 usec per loop
+ 1000000 loops, best of 3: 0.181 usec per loop
It should be noted that a real life function would probably do
something more useful than ``f`` here, and therefore in real life the
@@ -697,15 +680,15 @@ function is decorated the traceback will be longer:
.. code-block:: python
- >>> f()
+ >>> f() # doctest: +ELLIPSIS
Traceback (most recent call last):
...
File "<string>", line 2, in f
- File "<doctest __main__[18]>", line 4, in trace
+ File "<doctest __main__[22]>", line 4, in trace
return f(*args, **kw)
- File "<doctest __main__[47]>", line 3, in f
+ File "<doctest __main__[51]>", line 3, in f
1/0
- ZeroDivisionError: integer division or modulo by zero
+ ZeroDivisionError: ...
You see here the inner call to the decorator ``trace``, which calls
``f(*args, **kw)``, and a reference to ``File "<string>", line 2, in f``.
@@ -720,7 +703,7 @@ would require to change the CPython implementation of functions and
add an hook to make it possible to change their signature directly.
That could happen in future versions of Python (see PEP 362_) and
then the decorator module would become obsolete. However, at present,
-even in Python 3.1 it is impossible to change the function signature
+even in Python 3.2 it is impossible to change the function signature
directly, therefore the ``decorator`` module is still useful.
Actually, this is one of the main reasons why I keep maintaining
the module and releasing new versions.
@@ -730,38 +713,7 @@ the module and releasing new versions.
In the present implementation, decorators generated by ``decorator``
can only be used on user-defined Python functions or methods, not on generic
callable objects, nor on built-in functions, due to limitations of the
-``inspect`` module in the standard library. Moreover, notice
-that you can decorate a method, but only before if becomes a bound or unbound
-method, i.e. inside the class.
-Here is an example of valid decoration:
-
-.. code-block:: python
-
- >>> class C(object):
- ... @trace
- ... def meth(self):
- ... pass
-
-Here is an example of invalid decoration, when the decorator in
-called too late:
-
-.. code-block:: python
-
- >>> class C(object):
- ... def meth(self):
- ... pass
- ...
- >>> trace(C.meth)
- Traceback (most recent call last):
- ...
- TypeError: You are decorating a non function: <unbound method C.meth>
-
-The solution is to extract the inner function from the unbound method:
-
-.. code-block:: python
-
- >>> trace(C.meth.im_func) # doctest: +ELLIPSIS
- <function meth at 0x...>
+``inspect`` module in the standard library.
There is a restriction on the names of the arguments: for instance,
if try to call an argument ``_call_`` or ``_func_``
@@ -770,17 +722,16 @@ you will get a ``NameError``:
.. code-block:: python
>>> @trace
- ... def f(_func_): print f
- ...
+ ... def f(_func_): print(f)
+ ...
Traceback (most recent call last):
...
NameError: _func_ is overridden in
def f(_func_):
return _call_(_func_, _func_)
-Finally, the implementation is such that the decorated function
-attribute ``.func_globals`` is a *copy* of the original function
-attribute, just as the attribute dictionary of the decorated function.
+Finally, the implementation is such that the decorated function shares
+the original function dictionary:
.. code-block:: python
@@ -792,23 +743,57 @@ attribute, just as the attribute dictionary of the decorated function.
>>> traced_f.attr1
'something'
- >>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did not change
+ >>> traced_f.attr2 = "something different" # setting attr
+ >>> f.attr2 # the original attribute did not change
'something else'
Compatibility notes
---------------------------------------------------------------
-This version fully supports Python 3, including `function
-annotations`_. Moreover it is the first version to support
-generic callers, i.e. callable objects with the right
-signature, not necessarily functions. ``contextmanager``
-will not work in Python 2.4. The decorated function
-dictionary is now the same of the original function
-dictionary, wheread in past versions they were
-different objects.
-
-The examples shown here have been tested with Python 2.7 and 3.4. Python 2.4
+This version supports all Python releases from 2.6 to 3.5 with
+a single code base. In order to do so, I decided to drop the support
+for ancient versions of Python (Python 2.5 is nearly ten year old).
+If you need to support ancient versions of Python, stick with the
+decorator module 3.4.1.
+
+Historical notes
+-------------------------
+
+The decorator module is over ten years old. Here a few notes on its
+evolution, for whoever is interested.
+
+Version 3.4 fixes some bugs in the support of recent versions of
+Python 3. Version 3.3 was the first version of the ``decorator``
+module to fully support Python 3, including `function
+annotations`_. Version 3.2 was the first version to support Python 3
+via the ``2to3`` conversion tool. The hard work (for me) has been
+converting the documentation and the doctests. This has been possible
+only after that docutils_ and pygments_ have been ported to Python 3.
+
+Version 3 of the ``decorator`` module do not contain any backward
+incompatible change, apart from the removal of the functions
+``get_info`` and ``new_wrapper``, which have been deprecated for
+years. ``get_info`` has been removed since it was little used and
+since it had to be changed anyway to work with Python 3.0;
+``new_wrapper`` has been removed since it was useless: its major use
+case (converting signature changing decorators to signature preserving
+decorators) has been subsumed by ``decorator_apply``, whereas the other use
+case can be managed with the ``FunctionMaker``.
+
+There are a few changes in the documentation: I removed the
+``decorator_factory`` example, which was confusing some of my users,
+and I removed the part about exotic signatures in the Python 3
+documentation, since Python 3 does not support them.
+
+Finally ``decorator`` cannot be used as a class decorator and the
+`functionality introduced in version 2.3`_ has been removed. That
+means that in order to define decorator factories with classes you
+need to define the ``__call__`` method explicitly (no magic anymore).
+All these changes should not cause any trouble, since they were
+all rarely used features. Should you have any trouble, you can always
+downgrade to the 2.3 version.
+
+The examples shown here have been tested with Python 2.6. Python 2.4
is also supported - of course the examples requiring the ``with``
statement will not work there. Python 2.5 works fine, but if you
run the examples in the interactive interpreter
@@ -818,6 +803,7 @@ tuple. That means that running the file
``documentation.py`` under Python 2.5 will print a few errors, but
they are not serious.
+.. _functionality introduced in version 2.3: http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories
.. _function annotations: http://www.python.org/dev/peps/pep-3107/
.. _distribute: http://packages.python.org/distribute/
.. _docutils: http://docutils.sourceforge.net/
@@ -857,20 +843,68 @@ If you use this software and you are happy with it, consider sending me a
note, just to gratify my ego. On the other hand, if you use this software and
you are unhappy with it, send me a patch!
"""
-from __future__ import with_statement
+
+function_annotations = """Function annotations
+---------------------------------------------
+
+Python 3 introduced the concept of `function annotations`_,i.e. the ability
+to annotate the signature of a function with additional information,
+stored in a dictionary named ``__annotations__``. The decorator module,
+starting from release 3.3, is able to understand and to preserve the
+annotations. Here is an example:
+
+.. code-block:: python
+
+ >>> @trace
+ ... def f(x: 'the first argument', y: 'default argument'=1, z=2,
+ ... *args: 'varargs', **kw: 'kwargs'):
+ ... pass
+
+In order to introspect functions with annotations, one needs the
+utility ``inspect.getfullargspec``, new in Python 3:
+
+.. code-block:: python
+
+ >>> from inspect import getfullargspec
+ >>> argspec = getfullargspec(f)
+ >>> argspec.args
+ ['x', 'y', 'z']
+ >>> argspec.varargs
+ 'args'
+ >>> argspec.varkw
+ 'kw'
+ >>> argspec.defaults
+ (1, 2)
+ >>> argspec.kwonlyargs
+ []
+ >>> argspec.kwonlydefaults
+
+You can also check that the ``__annotations__`` dictionary is preserved:
+
+.. code-block:: python
+
+ >>> f.__annotations__ == f.__wrapped__.__annotations__
+ True
+
+Depending on the version of the decorator module, the two dictionaries can
+be the same object or not: you cannot rely on object identity, but you can
+rely on the content being the same.
+"""
import sys
import threading
import time
import functools
-import inspect
-import itertools
+import itertools
from decorator import *
-from functools import partial
from setup import VERSION
+if sys.version < '3':
+ function_annotations = ''
+
today = time.strftime('%Y-%m-%d')
-__doc__ = __doc__.replace('$VERSION', VERSION).replace('$DATE', today)
+__doc__ = (doc.replace('$VERSION', VERSION).replace('$DATE', today)
+ .replace('$FUNCTION_ANNOTATIONS', function_annotations))
def decorator_apply(dec, func):
@@ -884,7 +918,8 @@ def decorator_apply(dec, func):
def _trace(f, *args, **kw):
- print "calling %s with args %s, %s" % (f.__name__, args, kw)
+ kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
+ print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
return f(*args, **kw)
@@ -928,7 +963,7 @@ class Async(object):
counter = func.counter
except AttributeError: # instantiate the counter at the first call
counter = func.counter = itertools.count(1)
- name = '%s-%s' % (func.__name__, counter.next())
+ name = '%s-%s' % (func.__name__, next(counter))
def func_wrapper():
try:
@@ -951,7 +986,8 @@ def identity_dec(func):
@identity_dec
-def example(): pass
+def example():
+ pass
def memoize_uw(func):
@@ -1046,7 +1082,6 @@ class Action(object):
Traceback (most recent call last):
...
PermissionError: User does not have the permission to run insert!
-
"""
@restricted(User)
def view(self):
@@ -1118,12 +1153,53 @@ def a_test_for_pylons():
>>> decorator(_memoize).__name__
'_memoize'
- Here is another bug of version 3.1.1 missing the docstring to avoid:
+ Here is another bug of version 3.1.1 missing the docstring:
>>> factorial.__doc__
'The good old factorial'
"""
+if sys.version >= '3': # tests for signatures specific to Python 3
+
+ def test_kwonlydefaults():
+ """
+ >>> @trace
+ ... def f(arg, defarg=1, *args, kwonly=2): pass
+ ...
+ >>> f.__kwdefaults__
+ {'kwonly': 2}
+ """
+
+ def test_kwonlyargs():
+ """
+ >>> @trace
+ ... def func(a, b, *args, y=2, z=3, **kwargs):
+ ... return y, z
+ ...
+ >>> func('a', 'b', 'c', 'd', 'e', y='y', z='z', cat='dog')
+ calling func with args ('a', 'b', 'c', 'd', 'e'), {'cat': 'dog', 'y': 'y', 'z': 'z'}
+ ('y', 'z')
+ """
+
+ def test_kwonly_no_args():
+ """# this was broken with decorator 3.3.3
+ >>> @trace
+ ... def f(**kw): pass
+ ...
+ >>> f()
+ calling f with args (), {}
+ """
+
+ def test_kwonly_star_notation():
+ """
+ >>> @trace
+ ... def f(*, a=1, **kw): pass
+ ...
+ >>> import inspect
+ >>> inspect.getfullargspec(f)
+ FullArgSpec(args=[], varargs=None, varkw='kw', defaults=None, kwonlyargs=['a'], kwonlydefaults={'a': 1}, annotations={})
+ """
+
@contextmanager
def before_after(before, after):
diff --git a/documentation.rst b/documentation.rst
index 1fda579..37eb40b 100644
--- a/documentation.rst
+++ b/documentation.rst
@@ -4,10 +4,10 @@ The ``decorator`` module
:Author: Michele Simionato
:E-mail: michele.simionato@gmail.com
-:Version: 3.4.1 (2015-03-16)
-:Requires: Python 2.4+
-:Download page: http://pypi.python.org/pypi/decorator/3.4.1
-:Installation: ``easy_install decorator``
+:Version: 4.0.0 (2015-07-19)
+:Requires: Python 2.6+
+:Download page: http://pypi.python.org/pypi/decorator/4.0.0
+:Installation: ``pip install decorator``
:License: BSD license
.. contents::
@@ -112,7 +112,7 @@ been added in Python 2.5 expressly to simplify the definition of decorators
``__name__``, ``__doc__``, ``__module__`` and ``__dict__``
from the original function to the decorated function by hand).
-.. _functools.update_wrapper: https://docs.python.org/2/library/functools.html#functools.update_wrapper
+.. _functools.update_wrapper: https://docs.python.org/3/library/functools.html#functools.update_wrapper
The implementation above works in the sense that the decorator
can accept functions with generic signatures; unfortunately this
@@ -136,7 +136,7 @@ keyword arguments:
.. code-block:: python
>>> from inspect import getargspec
- >>> print getargspec(f1) # I am using Python 2.6+ here
+ >>> print(getargspec(f1))
ArgSpec(args=[], varargs='args', keywords='kw', defaults=None)
This means that introspection tools such as pydoc will give
@@ -147,10 +147,10 @@ argument, you will get an error:
.. code-block:: python
- >>> f1(0, 1)
+ >>> f1(0, 1)
Traceback (most recent call last):
...
- TypeError: f1() takes exactly 1 argument (2 given)
+ TypeError: f1() takes exactly 1 positional argument (2 given)
The solution
-----------------------------------------
@@ -210,17 +210,17 @@ Here is a test of usage:
... time.sleep(2)
... return "done"
- >>> print heavy_computation() # the first time it will take 2 seconds
+ >>> print(heavy_computation()) # the first time it will take 2 seconds
done
- >>> print heavy_computation() # the second time it will be instantaneous
+ >>> print(heavy_computation()) # the second time it will be instantaneous
done
The signature of ``heavy_computation`` is the one you would expect:
.. code-block:: python
- >>> print getargspec(heavy_computation)
+ >>> print(getargspec(heavy_computation))
ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
A ``trace`` decorator
@@ -233,7 +233,8 @@ function is called:
.. code-block:: python
def _trace(f, *args, **kw):
- print "calling %s with args %s, %s" % (f.__name__, args, kw)
+ kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
+ print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
return f(*args, **kw)
@@ -246,7 +247,7 @@ function is called:
Here is an example of usage:
.. code-block:: python
-
+
>>> @trace
... def f1(x):
... pass
@@ -262,7 +263,7 @@ and it that it has the correct signature:
.. code-block:: python
- >>> print getargspec(f1)
+ >>> print(getargspec(f1))
ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
The same decorator works with functions of any signature:
@@ -276,24 +277,55 @@ The same decorator works with functions of any signature:
>>> f(0, 3)
calling f with args (0, 3, 2), {}
- >>> print getargspec(f)
+ >>> print(getargspec(f))
ArgSpec(args=['x', 'y', 'z'], varargs='args', keywords='kw', defaults=(1, 2))
-That includes even functions with exotic signatures like the following:
+Function annotations
+---------------------------------------------
+
+Python 3 introduced the concept of `function annotations`_,i.e. the ability
+to annotate the signature of a function with additional information,
+stored in a dictionary named ``__annotations__``. The decorator module,
+starting from release 3.3, is able to understand and to preserve the
+annotations. Here is an example:
.. code-block:: python
>>> @trace
- ... def exotic_signature((x, y)=(1,2)): return x+y
+ ... def f(x: 'the first argument', y: 'default argument'=1, z=2,
+ ... *args: 'varargs', **kw: 'kwargs'):
+ ... pass
- >>> print getargspec(exotic_signature)
- ArgSpec(args=[['x', 'y']], varargs=None, keywords=None, defaults=((1, 2),))
- >>> exotic_signature()
- calling exotic_signature with args ((1, 2),), {}
- 3
+In order to introspect functions with annotations, one needs the
+utility ``inspect.getfullargspec``, new in Python 3:
+
+.. code-block:: python
+
+ >>> from inspect import getfullargspec
+ >>> argspec = getfullargspec(f)
+ >>> argspec.args
+ ['x', 'y', 'z']
+ >>> argspec.varargs
+ 'args'
+ >>> argspec.varkw
+ 'kw'
+ >>> argspec.defaults
+ (1, 2)
+ >>> argspec.kwonlyargs
+ []
+ >>> argspec.kwonlydefaults
+
+You can also check that the ``__annotations__`` dictionary is preserved:
+
+.. code-block:: python
+
+ >>> f.__annotations__ == f.__wrapped__.__annotations__
+ True
+
+Depending on the version of the decorator module, the two dictionaries can
+be the same object or not: you cannot rely on object identity, but you can
+rely on the content being the same.
-Notice that the support for exotic signatures has been deprecated
-in Python 2.6 and removed in Python 3.0.
``decorator`` is a decorator
---------------------------------------------
@@ -316,7 +348,8 @@ For instance, you can write directly
>>> @decorator
... def trace(f, *args, **kw):
- ... print "calling %s with args %s, %s" % (f.func_name, args, kw)
+ ... kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
+ ... print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
... return f(*args, **kw)
and now ``trace`` will be a decorator. Actually ``trace`` is a ``partial``
@@ -378,19 +411,19 @@ available. For instance:
... time.sleep(3) # simulate a blocking resource
... return "some data"
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
>>> time.sleep(1)
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
>>> time.sleep(1)
- >>> print read_data() # data is not available yet
+ >>> print(read_data()) # data is not available yet
Please wait ...
- >>> time.sleep(1.1) # after 3.1 seconds, data is available
- >>> print read_data()
+ >>> time.sleep(1.1) # after 3.1 seconds, data is available
+ >>> print(read_data())
some data
``async``
@@ -452,7 +485,7 @@ programming). The implementation is the following:
counter = func.counter
except AttributeError: # instantiate the counter at the first call
counter = func.counter = itertools.count(1)
- name = '%s-%s' % (func.__name__, counter.next())
+ name = '%s-%s' % (func.__name__, next(counter))
def func_wrapper():
try:
@@ -468,9 +501,9 @@ programming). The implementation is the following:
return thread
-The decorated function returns the current execution thread, which can
-be stored and checked later, for instance to verify that the
-thread ``.isAlive()``.
+The decorated function returns
+the current execution thread, which can be stored and checked later, for
+instance to verify that the thread ``.isAlive()``.
Here is an example of usage. Suppose one wants to write some data to
an external resource which can be accessed by a single user at once
@@ -498,23 +531,23 @@ be no synchronization problems since ``write`` is locked.
>>> write("data1")
<Thread(write-1, started...)>
-
+
>>> time.sleep(.1) # wait a bit, so we are sure data2 is written after data1
-
+
>>> write("data2")
<Thread(write-2, started...)>
-
+
>>> time.sleep(2) # wait for the writers to complete
-
- >>> print datalist
+
+ >>> print(datalist)
['data1', 'data2']
contextmanager
-------------------------------------
For a long time Python had in its standard library a ``contextmanager``
-decorator, able to convert generator functions into ``GeneratorContextManager``
-factories. For instance if you write
+decorator, able to convert generator functions into
+``GeneratorContextManager`` factories. For instance if you write
.. code-block:: python
@@ -532,11 +565,8 @@ the ``with`` statement:
.. code-block:: python
- >>> ba = before_after('BEFORE', 'AFTER')
- >>> type(ba)
- <class 'contextlib.GeneratorContextManager'>
- >>> with ba:
- ... print 'hello'
+ >>> with before_after('BEFORE', 'AFTER'):
+ ... print('hello')
BEFORE
hello
AFTER
@@ -551,7 +581,7 @@ method, so that they can be used as decorators as in this example:
>>> @ba
... def hello():
- ... print 'hello'
+ ... print('hello')
...
>>> hello()
BEFORE
@@ -574,10 +604,6 @@ will returns instances of ``ContextManager``, a subclass of
``contextlib.GeneratorContextManager`` with a ``__call__`` method
acting as a signature-preserving decorator.
-**Disclaimer**: the ``contextmanager`` decorator is an *experimental* feature:
-it may go away in future versions of the decorator module. Use it at your
-own risk.
-
The ``FunctionMaker`` class
---------------------------------------------------------------
@@ -598,7 +624,7 @@ were the function is generated by ``exec``. Here is an example:
.. code-block:: python
>>> def f(*args, **kw): # a function with a generic signature
- ... print args, kw
+ ... print(args, kw)
>>> f1 = FunctionMaker.create('f1(a, b)', 'f(a, b)', dict(f=f))
>>> f1(1,2)
@@ -621,7 +647,7 @@ be added to the generated function:
>>> f1 = FunctionMaker.create(
... 'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True)
- >>> print f1.__source__
+ >>> print(f1.__source__)
def f1(a, b):
f(a, b)
<BLANKLINE>
@@ -681,7 +707,8 @@ source code which is probably not what you want:
@identity_dec
def example(): pass
- >>> print inspect.getsource(example)
+ >>> import inspect
+ >>> print(inspect.getsource(example))
def wrapper(*args, **kw):
return func(*args, **kw)
<BLANKLINE>
@@ -696,7 +723,7 @@ undecorated function:
.. code-block:: python
- >>> print inspect.getsource(factorial.__wrapped__)
+ >>> print(inspect.getsource(factorial.__wrapped__))
@tail_recursive
def factorial(n, acc=1):
"The good old factorial"
@@ -801,7 +828,7 @@ Here is how you apply the upgraded decorator to the good old factorial:
.. code-block:: python
- >>> print factorial(4)
+ >>> print(factorial(4))
24
This decorator is pretty impressive, and should give you some food for
@@ -830,7 +857,7 @@ have a performance penalty.
The worse case is shown by the following example::
$ cat performance.sh
- python -m timeit -s "
+ python3 -m timeit -s "
from decorator import decorator
@decorator
@@ -842,7 +869,7 @@ The worse case is shown by the following example::
pass
" "f()"
- python -m timeit -s "
+ python3 -m timeit -s "
def f():
pass
" "f()"
@@ -851,8 +878,8 @@ On my MacBook, using the ``do_nothing`` decorator instead of the
plain function is more than three times slower::
$ bash performance.sh
- 1000000 loops, best of 3: 0.995 usec per loop
- 1000000 loops, best of 3: 0.273 usec per loop
+ 1000000 loops, best of 3: 0.669 usec per loop
+ 1000000 loops, best of 3: 0.181 usec per loop
It should be noted that a real life function would probably do
something more useful than ``f`` here, and therefore in real life the
@@ -874,15 +901,15 @@ function is decorated the traceback will be longer:
.. code-block:: python
- >>> f()
+ >>> f()
Traceback (most recent call last):
...
File "<string>", line 2, in f
- File "<doctest __main__[18]>", line 4, in trace
+ File "<doctest __main__[22]>", line 4, in trace
return f(*args, **kw)
- File "<doctest __main__[47]>", line 3, in f
+ File "<doctest __main__[51]>", line 3, in f
1/0
- ZeroDivisionError: integer division or modulo by zero
+ ZeroDivisionError: ...
You see here the inner call to the decorator ``trace``, which calls
``f(*args, **kw)``, and a reference to ``File "<string>", line 2, in f``.
@@ -897,7 +924,7 @@ would require to change the CPython implementation of functions and
add an hook to make it possible to change their signature directly.
That could happen in future versions of Python (see PEP 362_) and
then the decorator module would become obsolete. However, at present,
-even in Python 3.1 it is impossible to change the function signature
+even in Python 3.2 it is impossible to change the function signature
directly, therefore the ``decorator`` module is still useful.
Actually, this is one of the main reasons why I keep maintaining
the module and releasing new versions.
@@ -907,38 +934,7 @@ the module and releasing new versions.
In the present implementation, decorators generated by ``decorator``
can only be used on user-defined Python functions or methods, not on generic
callable objects, nor on built-in functions, due to limitations of the
-``inspect`` module in the standard library. Moreover, notice
-that you can decorate a method, but only before if becomes a bound or unbound
-method, i.e. inside the class.
-Here is an example of valid decoration:
-
-.. code-block:: python
-
- >>> class C(object):
- ... @trace
- ... def meth(self):
- ... pass
-
-Here is an example of invalid decoration, when the decorator in
-called too late:
-
-.. code-block:: python
-
- >>> class C(object):
- ... def meth(self):
- ... pass
- ...
- >>> trace(C.meth)
- Traceback (most recent call last):
- ...
- TypeError: You are decorating a non function: <unbound method C.meth>
-
-The solution is to extract the inner function from the unbound method:
-
-.. code-block:: python
-
- >>> trace(C.meth.im_func)
- <function meth at 0x...>
+``inspect`` module in the standard library.
There is a restriction on the names of the arguments: for instance,
if try to call an argument ``_call_`` or ``_func_``
@@ -947,17 +943,16 @@ you will get a ``NameError``:
.. code-block:: python
>>> @trace
- ... def f(_func_): print f
- ...
+ ... def f(_func_): print(f)
+ ...
Traceback (most recent call last):
...
NameError: _func_ is overridden in
def f(_func_):
return _call_(_func_, _func_)
-Finally, the implementation is such that the decorated function
-attribute ``.func_globals`` is a *copy* of the original function
-attribute, just as the attribute dictionary of the decorated function.
+Finally, the implementation is such that the decorated function shares
+the original function dictionary:
.. code-block:: python
@@ -969,23 +964,57 @@ attribute, just as the attribute dictionary of the decorated function.
>>> traced_f.attr1
'something'
- >>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did not change
+ >>> traced_f.attr2 = "something different" # setting attr
+ >>> f.attr2 # the original attribute did not change
'something else'
Compatibility notes
---------------------------------------------------------------
-This version fully supports Python 3, including `function
-annotations`_. Moreover it is the first version to support
-generic callers, i.e. callable objects with the right
-signature, not necessarily functions. ``contextmanager``
-will not work in Python 2.4. The decorated function
-dictionary is now the same of the original function
-dictionary, wheread in past versions they were
-different objects.
-
-The examples shown here have been tested with Python 2.7 and 3.4. Python 2.4
+This version supports all Python releases from 2.6 to 3.5 with
+a single code base. In order to do so, I decided to drop the support
+for ancient versions of Python (Python 2.5 is nearly ten year old).
+If you need to support ancient versions of Python, stick with the
+decorator module 3.4.1.
+
+Historical notes
+-------------------------
+
+The decorator module is over ten years old. Here a few notes on its
+evolution, for whoever is interested.
+
+Version 3.4 fixes some bugs in the support of recent versions of
+Python 3. Version 3.3 was the first version of the ``decorator``
+module to fully support Python 3, including `function
+annotations`_. Version 3.2 was the first version to support Python 3
+via the ``2to3`` conversion tool. The hard work (for me) has been
+converting the documentation and the doctests. This has been possible
+only after that docutils_ and pygments_ have been ported to Python 3.
+
+Version 3 of the ``decorator`` module do not contain any backward
+incompatible change, apart from the removal of the functions
+``get_info`` and ``new_wrapper``, which have been deprecated for
+years. ``get_info`` has been removed since it was little used and
+since it had to be changed anyway to work with Python 3.0;
+``new_wrapper`` has been removed since it was useless: its major use
+case (converting signature changing decorators to signature preserving
+decorators) has been subsumed by ``decorator_apply``, whereas the other use
+case can be managed with the ``FunctionMaker``.
+
+There are a few changes in the documentation: I removed the
+``decorator_factory`` example, which was confusing some of my users,
+and I removed the part about exotic signatures in the Python 3
+documentation, since Python 3 does not support them.
+
+Finally ``decorator`` cannot be used as a class decorator and the
+`functionality introduced in version 2.3`_ has been removed. That
+means that in order to define decorator factories with classes you
+need to define the ``__call__`` method explicitly (no magic anymore).
+All these changes should not cause any trouble, since they were
+all rarely used features. Should you have any trouble, you can always
+downgrade to the 2.3 version.
+
+The examples shown here have been tested with Python 2.6. Python 2.4
is also supported - of course the examples requiring the ``with``
statement will not work there. Python 2.5 works fine, but if you
run the examples in the interactive interpreter
@@ -995,6 +1024,7 @@ tuple. That means that running the file
``documentation.py`` under Python 2.5 will print a few errors, but
they are not serious.
+.. _functionality introduced in version 2.3: http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories
.. _function annotations: http://www.python.org/dev/peps/pep-3107/
.. _distribute: http://packages.python.org/distribute/
.. _docutils: http://docutils.sourceforge.net/
diff --git a/documentation3.pdf b/documentation3.pdf
deleted file mode 100644
index f75e2cc..0000000
--- a/documentation3.pdf
+++ /dev/null
@@ -1,6721 +0,0 @@
-%PDF-1.4
-%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
-1 0 obj
-<< /F1 2 0 R /F2 3 0 R /F3 4 0 R /F4 7 0 R /F5 46 0 R /F6 48 0 R >>
-endobj
-2 0 obj
-<< /BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font >>
-endobj
-3 0 obj
-<< /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font >>
-endobj
-4 0 obj
-<< /BaseFont /Courier-Bold /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font >>
-endobj
-5 0 obj
-<< /A << /S /URI /Type /Action /URI (mailto:michele.simionato@gmail.com) >> /Border [ 0 0 0 ] /Rect [ 153.7323 704.7736 289.4623 716.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-6 0 obj
-<< /A << /S /URI /Type /Action /URI (http://pypi.python.org/pypi/decorator/3.4.1) >> /Border [ 0 0 0 ] /Rect [ 153.7323 659.7736 526.5827 671.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-7 0 obj
-<< /BaseFont /Courier /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font >>
-endobj
-8 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 45 0 R /XYZ 62.69291 275.0236 0 ] /Rect [ 62.69291 560.7736 121.0229 572.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-9 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 45 0 R /XYZ 62.69291 275.0236 0 ] /Rect [ 527.0227 560.7736 532.5827 572.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-10 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 633.0236 0 ] /Rect [ 62.69291 542.7736 114.3629 554.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-11 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 633.0236 0 ] /Rect [ 527.0227 542.7736 532.5827 554.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-12 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 396.0236 0 ] /Rect [ 62.69291 524.7736 183.2629 536.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-13 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 49 0 R /XYZ 62.69291 396.0236 0 ] /Rect [ 527.0227 524.7736 532.5827 536.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-14 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 373.4236 0 ] /Rect [ 62.69291 506.7736 122.1429 518.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-15 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 51 0 R /XYZ 62.69291 373.4236 0 ] /Rect [ 527.0227 506.7736 532.5827 518.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-16 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 62.69291 488.7736 72.69291 500.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-17 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 72.69291 488.7736 108.6929 500.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-18 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 108.6929 488.7736 154.8129 500.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-19 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 52 0 R /XYZ 62.69291 370.2236 0 ] /Rect [ 527.0227 488.7736 532.5827 500.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-20 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 62.69291 470.7736 164.3629 482.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-21 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 54 0 R /XYZ 62.69291 501.4236 0 ] /Rect [ 527.0227 470.7736 532.5827 482.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-22 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 62.69291 452.7736 122.6929 464.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-23 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 122.6929 452.7736 188.2729 464.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-24 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 729.0236 0 ] /Rect [ 527.0227 452.7736 532.5827 464.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-25 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 302.4236 0 ] /Rect [ 62.69291 434.7736 110.6929 446.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-26 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 55 0 R /XYZ 62.69291 302.4236 0 ] /Rect [ 527.0227 434.7736 532.5827 446.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-27 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 422.6236 0 ] /Rect [ 62.69291 416.7736 92.69291 428.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-28 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 56 0 R /XYZ 62.69291 422.6236 0 ] /Rect [ 527.0227 416.7736 532.5827 428.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-29 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 58 0 R /XYZ 62.69291 563.8236 0 ] /Rect [ 62.69291 398.7736 139.9329 410.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-30 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 58 0 R /XYZ 62.69291 563.8236 0 ] /Rect [ 527.0227 398.7736 532.5827 410.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-31 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 657.0236 0 ] /Rect [ 62.69291 380.7736 83.25291 392.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-32 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 657.0236 0 ] /Rect [ 83.25291 380.7736 167.2529 392.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-33 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 657.0236 0 ] /Rect [ 167.2529 380.7736 192.2729 392.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-34 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 59 0 R /XYZ 62.69291 657.0236 0 ] /Rect [ 521.4627 380.7736 532.5827 392.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-35 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 681.0236 0 ] /Rect [ 62.69291 362.7736 177.1629 374.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-36 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 681.0236 0 ] /Rect [ 521.4627 362.7736 532.5827 374.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-37 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 222.4236 0 ] /Rect [ 62.69291 344.7736 228.2829 356.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-38 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 61 0 R /XYZ 62.69291 222.4236 0 ] /Rect [ 521.4627 344.7736 532.5827 356.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-39 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 64 0 R /XYZ 62.69291 465.4236 0 ] /Rect [ 62.69291 326.7736 174.3929 338.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-40 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 64 0 R /XYZ 62.69291 465.4236 0 ] /Rect [ 521.4627 326.7736 532.5827 338.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-41 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 71 0 R /XYZ 62.69291 631.8236 0 ] /Rect [ 62.69291 308.7736 155.4829 320.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-42 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 71 0 R /XYZ 62.69291 631.8236 0 ] /Rect [ 521.4627 308.7736 532.5827 320.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-43 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 71 0 R /XYZ 62.69291 280.8236 0 ] /Rect [ 62.69291 290.7736 106.5829 302.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-44 0 obj
-<< /Border [ 0 0 0 ] /Contents () /Dest [ 71 0 R /XYZ 62.69291 280.8236 0 ] /Rect [ 521.4627 290.7736 532.5827 302.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-45 0 obj
-<< /Annots [ 5 0 R 6 0 R 8 0 R 9 0 R 10 0 R 11 0 R 12 0 R 13 0 R 14 0 R 15 0 R
- 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R 24 0 R 25 0 R
- 26 0 R 27 0 R 28 0 R 29 0 R 30 0 R 31 0 R 32 0 R 33 0 R 34 0 R 35 0 R
- 36 0 R 37 0 R 38 0 R 39 0 R 40 0 R 41 0 R 42 0 R 43 0 R 44 0 R ] /Contents 93 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-46 0 obj
-<< /BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F5 /Subtype /Type1 /Type /Font >>
-endobj
-47 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/moin/PythonDecoratorLibrary) >> /Border [ 0 0 0 ] /Rect [ 219.6428 321.7736 449.1728 333.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-48 0 obj
-<< /BaseFont /Courier-Oblique /Encoding /WinAnsiEncoding /Name /F6 /Subtype /Type1 /Type /Font >>
-endobj
-49 0 obj
-<< /Annots [ 47 0 R ] /Contents 94 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-50 0 obj
-<< /A << /S /URI /Type /Action /URI (https://docs.python.org/3/library/functools.html#functools.update_wrapper) >> /Border [ 0 0 0 ] /Rect [ 151.0486 753.7736 270.69 765.7736 ] /Subtype /Link /Type /Annot >>
-endobj
-51 0 obj
-<< /Annots [ 50 0 R ] /Contents 95 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-52 0 obj
-<< /Contents 96 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-53 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-3107/) >> /Border [ 0 0 0 ] /Rect [ 231.6368 463.1736 323.0741 475.1736 ] /Subtype /Link /Type /Annot >>
-endobj
-54 0 obj
-<< /Annots [ 53 0 R ] /Contents 97 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-55 0 obj
-<< /Contents 98 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-56 0 obj
-<< /Contents 99 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-57 0 obj
-<< /Contents 100 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-58 0 obj
-<< /Contents 101 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-59 0 obj
-<< /Contents 102 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-60 0 obj
-<< /A << /S /URI /Type /Action /URI (http://bugs.python.org/issue1764286) >> /Border [ 0 0 0 ] /Rect [ 137.6966 388.3736 180.8679 400.3736 ] /Subtype /Link /Type /Annot >>
-endobj
-61 0 obj
-<< /Annots [ 60 0 R ] /Contents 103 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-62 0 obj
-<< /A << /S /URI /Type /Action /URI (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) >> /Border [ 0 0 0 ] /Rect [ 62.69291 576.5736 363.4029 588.5736 ] /Subtype /Link /Type /Annot >>
-endobj
-63 0 obj
-<< /Annots [ 62 0 R ] /Contents 104 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-64 0 obj
-<< /Contents 105 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-65 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-0362) >> /Border [ 0 0 0 ] /Rect [ 301.1597 371.3736 317.8397 383.3736 ] /Subtype /Link /Type /Annot >>
-endobj
-66 0 obj
-<< /Annots [ 65 0 R ] /Contents 106 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-67 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.python.org/dev/peps/pep-3107/) >> /Border [ 0 0 0 ] /Rect [ 384.6306 581.5736 474.9013 593.5736 ] /Subtype /Link /Type /Annot >>
-endobj
-68 0 obj
-<< /A << /S /URI /Type /Action /URI (http://docutils.sourceforge.net/) >> /Border [ 0 0 0 ] /Rect [ 476.7077 557.5736 515.9027 569.5736 ] /Subtype /Link /Type /Annot >>
-endobj
-69 0 obj
-<< /A << /S /URI /Type /Action /URI (http://pygments.org/) >> /Border [ 0 0 0 ] /Rect [ 62.69291 545.5736 108.8229 557.5736 ] /Subtype /Link /Type /Annot >>
-endobj
-70 0 obj
-<< /A << /S /URI /Type /Action /URI (http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories) >> /Border [ 0 0 0 ] /Rect [ 364.2921 407.5736 531.64 419.5736 ] /Subtype /Link /Type /Annot >>
-endobj
-71 0 obj
-<< /Annots [ 67 0 R 68 0 R 69 0 R 70 0 R ] /Contents 107 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0
- /Trans << >> /Type /Page >>
-endobj
-72 0 obj
-<< /Contents 108 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 92 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /Rotate 0 /Trans << >>
- /Type /Page >>
-endobj
-73 0 obj
-<< /Outlines 75 0 R /PageLabels 109 0 R /PageMode /UseNone /Pages 92 0 R /Type /Catalog >>
-endobj
-74 0 obj
-<< /Author (Michele Simionato) /CreationDate (D:20150316162017-01'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\))
- /Title (The decorator module) >>
-endobj
-75 0 obj
-<< /Count 16 /First 76 0 R /Last 91 0 R /Type /Outlines >>
-endobj
-76 0 obj
-<< /Dest [ 45 0 R /XYZ 62.69291 275.0236 0 ] /Next 77 0 R /Parent 75 0 R /Title (Introduction) >>
-endobj
-77 0 obj
-<< /Dest [ 49 0 R /XYZ 62.69291 633.0236 0 ] /Next 78 0 R /Parent 75 0 R /Prev 76 0 R /Title (Definitions) >>
-endobj
-78 0 obj
-<< /Dest [ 49 0 R /XYZ 62.69291 396.0236 0 ] /Next 79 0 R /Parent 75 0 R /Prev 77 0 R /Title (Statement of the problem) >>
-endobj
-79 0 obj
-<< /Dest [ 51 0 R /XYZ 62.69291 373.4236 0 ] /Next 80 0 R /Parent 75 0 R /Prev 78 0 R /Title (The solution) >>
-endobj
-80 0 obj
-<< /Dest [ 52 0 R /XYZ 62.69291 370.2236 0 ] /Next 81 0 R /Parent 75 0 R /Prev 79 0 R /Title (A trace decorator) >>
-endobj
-81 0 obj
-<< /Dest [ 54 0 R /XYZ 62.69291 501.4236 0 ] /Next 82 0 R /Parent 75 0 R /Prev 80 0 R /Title (Function annotations) >>
-endobj
-82 0 obj
-<< /Dest [ 55 0 R /XYZ 62.69291 729.0236 0 ] /Next 83 0 R /Parent 75 0 R /Prev 81 0 R /Title (decorator is a decorator) >>
-endobj
-83 0 obj
-<< /Dest [ 55 0 R /XYZ 62.69291 302.4236 0 ] /Next 84 0 R /Parent 75 0 R /Prev 82 0 R /Title (blocking) >>
-endobj
-84 0 obj
-<< /Dest [ 56 0 R /XYZ 62.69291 422.6236 0 ] /Next 85 0 R /Parent 75 0 R /Prev 83 0 R /Title (async) >>
-endobj
-85 0 obj
-<< /Dest [ 58 0 R /XYZ 62.69291 563.8236 0 ] /Next 86 0 R /Parent 75 0 R /Prev 84 0 R /Title (contextmanager) >>
-endobj
-86 0 obj
-<< /Dest [ 59 0 R /XYZ 62.69291 657.0236 0 ] /Next 87 0 R /Parent 75 0 R /Prev 85 0 R /Title (The FunctionMaker class) >>
-endobj
-87 0 obj
-<< /Dest [ 61 0 R /XYZ 62.69291 681.0236 0 ] /Next 88 0 R /Parent 75 0 R /Prev 86 0 R /Title (Getting the source code) >>
-endobj
-88 0 obj
-<< /Dest [ 61 0 R /XYZ 62.69291 222.4236 0 ] /Next 89 0 R /Parent 75 0 R /Prev 87 0 R /Title (Dealing with third party decorators) >>
-endobj
-89 0 obj
-<< /Dest [ 64 0 R /XYZ 62.69291 465.4236 0 ] /Next 90 0 R /Parent 75 0 R /Prev 88 0 R /Title (Caveats and limitations) >>
-endobj
-90 0 obj
-<< /Dest [ 71 0 R /XYZ 62.69291 631.8236 0 ] /Next 91 0 R /Parent 75 0 R /Prev 89 0 R /Title (Compatibility notes) >>
-endobj
-91 0 obj
-<< /Dest [ 71 0 R /XYZ 62.69291 280.8236 0 ] /Parent 75 0 R /Prev 90 0 R /Title (LICENCE) >>
-endobj
-92 0 obj
-<< /Count 16 /Kids [ 45 0 R 49 0 R 51 0 R 52 0 R 54 0 R 55 0 R 56 0 R 57 0 R 58 0 R 59 0 R
- 61 0 R 63 0 R 64 0 R 66 0 R 71 0 R 72 0 R ] /Type /Pages >>
-endobj
-93 0 obj
-<< /Length 8970 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 741.0236 cm
-q
-BT 1 0 0 1 0 4 Tm 118.8249 0 Td 24 TL /F2 20 Tf 0 0 0 rg (The ) Tj /F3 20 Tf 0 0 0 rg (decorator ) Tj /F2 20 Tf 0 0 0 rg (module) Tj T* -118.8249 0 Td ET
-Q
-Q
-q
-1 0 0 1 62.69291 716.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 36.93937 0 Td (Author:) Tj T* -36.93937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Michele Simionato) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 701.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 39.69937 0 Td (E-mail:) Tj T* -39.69937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 .501961 rg (michele.simionato@gmail.com) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 686.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 33.02937 0 Td (Version:) Tj T* -33.02937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (3.4.1 \(2015-03-16\)) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 671.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 26.91937 0 Td (Requires:) Tj T* -26.91937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Python 2.4+) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 644.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F2 10 Tf 12 TL 25.25937 0 Td (Download) Tj T* 21.11 0 Td (page:) Tj T* -46.36937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 15 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (http://pypi.python.org/pypi/decorator/3.4.1) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 629.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 16.91937 0 Td (Installation:) Tj T* -16.91937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F4 10 Tf 0 0 0 rg (easy_install) Tj ( ) Tj (decorator) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 614.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 32.46937 0 Td (License:) Tj T* -32.46937 0 Td ET
-Q
-Q
-q
-1 0 0 1 91.03937 3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (BSD license) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 581.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Contents) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 287.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 0 273 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Introduction) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 273 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (1) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 255 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Definitions) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 255 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 237 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Statement of the problem) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 237 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (2) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 219 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (The solution) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 219 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (3) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 201 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (A ) Tj /F3 10 Tf 0 0 0 rg (trace ) Tj /F2 10 Tf 0 0 .501961 rg (decorator) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 201 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (4) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 183 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Function annotations) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 183 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (5) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 165 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (decorator ) Tj /F2 10 Tf 0 0 .501961 rg (is a decorator) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 165 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (6) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 147 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (blocking) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 147 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (6) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 129 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F3 10 Tf 0 0 0 rg (async) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 129 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (7) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 111 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (contextmanager) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 111 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 66.44 0 Td (9) Tj T* -66.44 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 93 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (The ) Tj /F3 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F2 10 Tf 0 0 .501961 rg (class) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 93 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (10) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 75 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Getting the source code) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 75 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (11) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 57 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Dealing with third party decorators) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 57 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (11) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 39 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Caveats and limitations) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 39 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (13) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 21 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (Compatibility notes) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 21 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (15) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-1 0 0 1 0 3 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F2 10 Tf 0 0 .501961 rg (LICENCE) Tj T* ET
-Q
-Q
-q
-1 0 0 1 397.8898 3 cm
-q
-0 0 .501961 rg
-0 0 .501961 RG
-BT 1 0 0 1 0 2 Tm /F2 10 Tf 12 TL 60.88 0 Td (15) Tj T* -60.88 0 Td ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 254.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Introduction) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 188.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 50 Tm /F1 10 Tf 12 TL 3.995366 Tw (Python decorators are an interesting example of why syntactic sugar matters. In principle, their) Tj T* 0 Tw .151235 Tw (introduction in Python 2.4 changed nothing, since they do not provide any new functionality which was not) Tj T* 0 Tw 2.238555 Tw (already present in the language. In practice, their introduction has significantly changed the way we) Tj T* 0 Tw .098409 Tw (structure our programs in Python. I believe the change is for the best, and that decorators are a great idea) Tj T* 0 Tw (since:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 182.0236 cm
-Q
-q
-1 0 0 1 62.69291 182.0236 cm
-Q
-q
-1 0 0 1 62.69291 170.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (decorators help reducing boilerplate code;) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 164.0236 cm
-Q
-q
-1 0 0 1 62.69291 152.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (decorators help separation of concerns;) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 146.0236 cm
-Q
-q
-1 0 0 1 62.69291 134.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (decorators enhance readability and maintenability;) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 128.0236 cm
-Q
-q
-1 0 0 1 62.69291 116.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (decorators are explicit.) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 116.0236 cm
-Q
-
-endstream
-endobj
-94 0 obj
-<< /Length 12226 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 729.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL .848876 Tw (Still, as of now, writing custom decorators correctly requires some experience and it is not as easy as it) Tj T* 0 Tw 1.049269 Tw (could be. For instance, typical implementations of decorators involve nested functions, and we all know) Tj T* 0 Tw (that flat is better than nested.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 675.0236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.093735 Tw 12 TL /F1 10 Tf 0 0 0 rg (The aim of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module it to simplify the usage of decorators for the average programmer,) Tj T* 0 Tw 2.456136 Tw (and to popularize decorators by showing various non-trivial examples. Of course, as all techniques,) Tj T* 0 Tw 2.234987 Tw (decorators can be abused \(I have seen that\) and you should not try to solve every problem with a) Tj T* 0 Tw (decorator, just because you can.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 645.0236 cm
-q
-BT 1 0 0 1 0 14 Tm .13561 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may find the source code for all the examples discussed here in the ) Tj /F4 10 Tf 0 0 0 rg (documentation.py ) Tj /F1 10 Tf 0 0 0 rg (file, which) Tj T* 0 Tw (contains this documentation in the form of doctests.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 612.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Definitions) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 570.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 2.37561 Tw (Technically speaking, any Python object which can be called with one argument can be used as a) Tj T* 0 Tw .472339 Tw (decorator. However, this definition is somewhat too large to be really useful. It is more convenient to split) Tj T* 0 Tw (the generic class of decorators in two subclasses:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 564.0236 cm
-Q
-q
-1 0 0 1 62.69291 564.0236 cm
-Q
-q
-1 0 0 1 62.69291 540.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 9 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-BT 1 0 0 1 0 14 Tm 2.68748 Tw 12 TL /F5 10 Tf 0 0 0 rg (signature-preserving ) Tj /F1 10 Tf (decorators, i.e. callable objects taking a function as input and returning a) Tj T* 0 Tw (function ) Tj /F5 10 Tf (with the same signature ) Tj /F1 10 Tf (as output;) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 534.0236 cm
-Q
-q
-1 0 0 1 62.69291 510.0236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-q
-1 0 0 1 6 9 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 10.5 0 Td (\177) Tj T* -10.5 0 Td ET
-Q
-Q
-q
-1 0 0 1 23 -3 cm
-q
-BT 1 0 0 1 0 14 Tm 1.43498 Tw 12 TL /F5 10 Tf 0 0 0 rg (signature-changing ) Tj /F1 10 Tf (decorators, i.e. decorators that change the signature of their input function, or) Tj T* 0 Tw (decorators returning non-callable objects.) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 510.0236 cm
-Q
-q
-1 0 0 1 62.69291 468.0236 cm
-q
-BT 1 0 0 1 0 26 Tm 2.832706 Tw 12 TL /F1 10 Tf 0 0 0 rg (Signature-changing decorators have their use: for instance the builtin classes ) Tj /F4 10 Tf 0 0 0 rg (staticmethod ) Tj /F1 10 Tf 0 0 0 rg (and) Tj T* 0 Tw 1.506651 Tw /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (are in this group, since they take functions and return descriptor objects which are not) Tj T* 0 Tw (functions, nor callables.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 438.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.735814 Tw (However, signature-preserving decorators are more common and easier to reason about; in particular) Tj T* 0 Tw (signature-preserving decorators can be composed together whereas other decorators in general cannot.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 408.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .494983 Tw (Writing signature-preserving decorators from scratch is not that obvious, especially if one wants to define) Tj T* 0 Tw (proper decorators that can accept functions with any signature. A simple example will clarify the issue.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 375.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Statement of the problem) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 297.0236 cm
-q
-BT 1 0 0 1 0 62 Tm .351235 Tw 12 TL /F1 10 Tf 0 0 0 rg (A very common use case for decorators is the memoization of functions. A ) Tj /F4 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (decorator works by) Tj T* 0 Tw .871988 Tw (caching the result of the function call in a dictionary, so that the next time the function is called with the) Tj T* 0 Tw 2.350651 Tw (same input parameters the result is retrieved from the cache and not recomputed. There are many) Tj T* 0 Tw 2.92247 Tw (implementations of ) Tj /F4 10 Tf 0 0 0 rg (memoize ) Tj /F1 10 Tf 0 0 0 rg (in ) Tj 0 0 .501961 rg (http://www.python.org/moin/PythonDecoratorLibrary) Tj 0 0 0 rg (, but they do not) Tj T* 0 Tw 2.683984 Tw (preserve the signature. A simple implementation could be the following \(notice that in general it is) Tj T* 0 Tw (impossible to memoize correctly something that depends on non-hashable arguments\):) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 95.82362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 192 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 168.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 168.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 84 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 168.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 114 168.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 156.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 90 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 156.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 132.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 132.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 90 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 132.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 132.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 132.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 132.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 120.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 120.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 78 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 120.75 246 12 re f*
-.960784 .960784 .862745 rg
-n 72 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 132 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 108.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 198 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 216 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 108.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 276 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 96.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 90 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 108 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 138 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 144 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 168 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 192 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 228 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 234 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 240 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 264 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 288 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 300 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 84 12 re f*
-.960784 .960784 .862745 rg
-n 210 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 258 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 270 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 294 .75 6 12 re f*
-BT 1 0 0 1 0 170 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize_uw) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (functools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (update_wrapper) Tj 0 0 0 rg (\() Tj 0 0 0 rg (memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-95 0 obj
-<< /Length 16361 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 717.0236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.801412 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here we used the ) Tj 0 0 .501961 rg (functools.update_wrapper ) Tj 0 0 0 rg (utility, which has been added in Python 2.5 expressly to) Tj T* 0 Tw .91686 Tw (simplify the definition of decorators \(in older versions of Python you need to copy the function attributes) Tj T* 0 Tw .580814 Tw /F4 10 Tf 0 0 0 rg (__name__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (__module__ ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (__dict__ ) Tj /F1 10 Tf 0 0 0 rg (from the original function to the decorated function) Tj T* 0 Tw (by hand\).) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 675.0236 cm
-q
-BT 1 0 0 1 0 26 Tm 2.517126 Tw 12 TL /F1 10 Tf 0 0 0 rg (The implementation above works in the sense that the decorator can accept functions with generic) Tj T* 0 Tw 1.233615 Tw (signatures; unfortunately this implementation does ) Tj /F5 10 Tf (not ) Tj /F1 10 Tf (define a signature-preserving decorator, since in) Tj T* 0 Tw (general ) Tj /F4 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (returns a function with a ) Tj /F5 10 Tf (different signature ) Tj /F1 10 Tf (from the original function.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 657.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Consider for instance the following case:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 587.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 192 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize_uw) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate some long computation) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (x) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 555.8236 cm
-q
-BT 1 0 0 1 0 14 Tm .26311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Here the original function takes a single argument named ) Tj /F4 10 Tf 0 0 0 rg (x) Tj /F1 10 Tf 0 0 0 rg (, but the decorated function takes any number) Tj T* 0 Tw (of arguments and keyword arguments:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 498.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 144 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 246 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 288 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 336 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 342 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 366 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (inspect) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 454.6236 cm
-q
-BT 1 0 0 1 0 26 Tm .411235 Tw 12 TL /F1 10 Tf 0 0 0 rg (This means that introspection tools such as pydoc will give wrong informations about the signature of ) Tj /F4 10 Tf 0 0 0 rg (f1) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* 0 Tw .161654 Tw (This is pretty bad: pydoc will tell you that the function accepts a generic signature ) Tj /F4 10 Tf 0 0 0 rg (*args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (**kw) Tj /F1 10 Tf 0 0 0 rg (, but when) Tj T* 0 Tw (you try to call the function with more than an argument, you will get an error:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 385.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 36 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 192 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 18 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 54 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 96 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 180 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 192 .75 60 12 re f*
-.960784 .960784 .862745 rg
-n 258 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 312 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 318 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 330 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 360 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (TypeError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (takes) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (exactly) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (positional) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argument) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (given) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 352.4236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (The solution) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 310.4236 cm
-q
-BT 1 0 0 1 0 26 Tm 3.313984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The solution is to provide a generic factory of generators, which hides the complexity of making) Tj T* 0 Tw 3.362976 Tw (signature-preserving decorators from the application programmer. The ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function in the) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is such a factory:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 277.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 24 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 54 12 re f*
-BT 1 0 0 1 0 2 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (decorator) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 221.2236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.716412 Tw 12 TL /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (takes two arguments, a caller function describing the functionality of the decorator and a) Tj T* 0 Tw 2.594983 Tw (function to be decorated; it returns the decorated function. The caller function must have signature) Tj T* 0 Tw .19311 Tw /F4 10 Tf 0 0 0 rg (\(f,) Tj ( ) Tj (*args,) Tj ( ) Tj (**kw\) ) Tj /F1 10 Tf 0 0 0 rg (and it must call the original function ) Tj /F4 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (with arguments ) Tj /F4 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (kw) Tj /F1 10 Tf 0 0 0 rg (, implementing) Tj T* 0 Tw (the wanted capability, i.e. memoization in this case:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 92.02362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 120 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 96.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 102 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 96.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 144 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 168 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 180 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 54 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 84.75 246 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 72.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 174 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 72.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 192 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 72.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 252 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 144 36.75 174 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 114 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 144 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 6 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# frozenset is used to ensure hashability) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (frozenset) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (iteritems) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# attributed added by memoize) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (key) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-96 0 obj
-<< /Length 18477 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 727.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 102 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 168 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 204 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 210 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 240 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 264 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 276 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 36 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ([) Tj 0 0 0 rg (key) Tj 0 0 0 rg (]) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 707.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (At this point you can define your decorator as follows:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 650.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (memoize) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (cache) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_memoize) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 606.6236 cm
-q
-BT 1 0 0 1 0 26 Tm .12561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The difference with respect to the ) Tj /F4 10 Tf 0 0 0 rg (memoize_uw ) Tj /F1 10 Tf 0 0 0 rg (approach, which is based on nested functions, is that the) Tj T* 0 Tw 2.59528 Tw (decorator module forces you to lift the inner function at the outer level \() Tj /F5 10 Tf (flat is better than nested) Tj /F1 10 Tf (\).) Tj T* 0 Tw (Moreover, you are forced to pass explicitly the function you want to decorate to the caller function.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 588.6236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is a test of usage:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 447.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 132 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 108.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 0 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 96.75 102 12 re f*
-.960784 .960784 .862745 rg
-n 150 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 84.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 108 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 72.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 48.75 102 12 re f*
-.960784 .960784 .862745 rg
-n 162 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 186 48.75 234 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 102 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 186 12.75 252 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 24 12 re f*
-BT 1 0 0 1 0 110 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@memoize) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (heavy_computation) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("done") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the first time it will take 2 seconds) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the second time it will be instantaneous) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (done) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 427.4236 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (The signature of ) Tj /F4 10 Tf 0 0 0 rg (heavy_computation ) Tj /F1 10 Tf 0 0 0 rg (is the one you would expect:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 382.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 102 12 re f*
-.960784 .960784 .862745 rg
-n 228 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 234 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 240 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 264 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 324 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 330 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 354 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (heavy_computation) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 349.2236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (A ) Tj /F3 17.5 Tf 0 0 0 rg (trace ) Tj /F2 17.5 Tf 0 0 0 rg (decorator) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 319.2236 cm
-q
-BT 1 0 0 1 0 14 Tm .479398 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an additional example, here is how you can define a trivial ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (decorator, which prints a message) Tj T* 0 Tw (everytime the traced function is called:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 250.0236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 114 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 138 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 174 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 234 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 240 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 246 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 264 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 288 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 300 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 318 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 354 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 360 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 372 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 192 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 204 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 222 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 234 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 252 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 270 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 282 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 330 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 342 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 366 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 378 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 408 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (_trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (', ') Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (join) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg (') Tj /F3 10 Tf .733333 .4 .533333 rg (%r) Tj /F4 10 Tf .729412 .129412 .129412 rg (: ) Tj /F3 10 Tf .733333 .4 .533333 rg (%r) Tj /F4 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (k) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg ([) Tj 0 0 0 rg (k) Tj 0 0 0 rg (]\)) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (for) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (k) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (sorted) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("calling ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (, {) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (}") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 204.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_trace) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 184.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of usage:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 127.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 107.6236 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (It is immediate to verify that ) Tj /F4 10 Tf 0 0 0 rg (f1 ) Tj /F1 10 Tf 0 0 0 rg (works) Tj T* ET
-Q
-Q
-
-endstream
-endobj
-97 0 obj
-<< /Length 21381 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 727.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 707.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (and it that it has the correct signature:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 662.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 252 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 258 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 282 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 294 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 342 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 348 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 372 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 642.6236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (The same decorator works with functions of any signature:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 513.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 474 120 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 192 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 204 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 90 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 186 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 42 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 180 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 222 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 264 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 324 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 330 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 354 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 366 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 414 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 420 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 426 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 432 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 444 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 450 .75 12 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (z) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (getargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* 0 0 0 rg (ArgSpec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('z') Tj 0 0 0 rg (],) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (varargs) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (keywords) Tj .4 .4 .4 rg (=) Tj .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (defaults) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 480.4236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Function annotations) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 426.4236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.937318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Python 3 introduced the concept of ) Tj 0 0 .501961 rg (function annotations) Tj 0 0 0 rg (,i.e. the ability to annotate the signature of a) Tj T* 0 Tw 2.24816 Tw (function with additional information, stored in a dictionary named ) Tj /F4 10 Tf 0 0 0 rg (__annotations__) Tj /F1 10 Tf 0 0 0 rg (. The decorator) Tj T* 0 Tw 1.923735 Tw (module, starting from release 3.3, is able to understand and to preserve the annotations. Here is an) Tj T* 0 Tw (example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 357.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 120 12 re f*
-.960784 .960784 .862745 rg
-n 198 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 24.75 108 12 re f*
-.960784 .960784 .862745 rg
-n 336 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 342 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 348 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 360 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 366 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 372 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 378 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 156 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 180 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 192 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 252 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (x) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('the first argument') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (y) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('default argument') Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (z) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('varargs') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('kwargs') Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 325.2236 cm
-q
-BT 1 0 0 1 0 14 Tm .596647 Tw 12 TL /F1 10 Tf 0 0 0 rg (In order to introspect functions with annotations, one needs the utility ) Tj /F4 10 Tf 0 0 0 rg (inspect.getfullargspec) Tj /F1 10 Tf 0 0 0 rg (, new) Tj T* 0 Tw (in Python 3:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 148.0236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 168 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 144.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 144.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 144.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 144.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 144.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 144.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 144 144.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 0 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 132.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 72 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 132.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 168 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 120.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 120.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 54 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 84 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 0 84.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 84 12 re f*
-BT 1 0 0 1 0 146 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (inspect) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (getfullargspec) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (getfullargspec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (args) Tj 0 0 0 rg T* 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('x') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('y') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('z') Tj 0 0 0 rg (]) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (varargs) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('args') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (varkw) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('kw') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (defaults) Tj 0 0 0 rg T* 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (kwonlyargs) Tj 0 0 0 rg T* 0 0 0 rg ([]) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (argspec) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (kwonlydefaults) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 128.0236 cm
-q
-BT 1 0 0 1 0 2 Tm 12 TL /F1 10 Tf 0 0 0 rg (You can also check that the ) Tj /F4 10 Tf 0 0 0 rg (__annotations__ ) Tj /F1 10 Tf 0 0 0 rg (dictionary is preserved:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 82.82362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 228 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 234 12.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 24 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__annotations__) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__wrapped__) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__annotations__) Tj 0 0 0 rg T* 0 .501961 0 rg (True) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-98 0 obj
-<< /Length 19143 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 741.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .011098 Tw (Depending on the version of the decorator module, the two dictionaries can be the same object or not: you) Tj T* 0 Tw (cannot rely on object identity, but you can rely on the content being the same.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 708.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (decorator ) Tj /F2 17.5 Tf 0 0 0 rg (is a decorator) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 606.0236 cm
-q
-BT 1 0 0 1 0 86 Tm .643876 Tw 12 TL /F1 10 Tf 0 0 0 rg (It may be annoying to write a caller function \(like the ) Tj /F4 10 Tf 0 0 0 rg (_trace ) Tj /F1 10 Tf 0 0 0 rg (function above\) and then a trivial wrapper) Tj T* 0 Tw 1.510888 Tw (\() Tj /F4 10 Tf 0 0 0 rg (def) Tj ( ) Tj (trace\(f\):) Tj ( ) Tj (return) Tj ( ) Tj (decorator\(_trace,) Tj ( ) Tj (f\)) Tj /F1 10 Tf 0 0 0 rg (\) every time. For this reason, the ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj T* 0 Tw .334269 Tw /F1 10 Tf 0 0 0 rg (module provides an easy shortcut to convert the caller function into a signature-preserving decorator: you) Tj T* 0 Tw 7.364269 Tw (can just call ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (with a single argument. In our example you can just write) Tj T* 0 Tw .951647 Tw /F4 10 Tf 0 0 0 rg (trace) Tj ( ) Tj (=) Tj ( ) Tj (decorator\(_trace\)) Tj /F1 10 Tf 0 0 0 rg (. The ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (function can also be used as a signature-changing) Tj T* 0 Tw 1.077752 Tw (decorator, just as ) Tj /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (staticmethod) Tj /F1 10 Tf 0 0 0 rg (. However, ) Tj /F4 10 Tf 0 0 0 rg (classmethod ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (staticmethod) Tj T* 0 Tw .531797 Tw /F1 10 Tf 0 0 0 rg (return generic objects which are not callable, while ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (returns signature-preserving decorators,) Tj T* 0 Tw (i.e. functions of a single argument. For instance, you can write directly) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 524.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 72 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 132 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 156 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 168 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 174 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 186 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 198 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 234 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 246 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 258 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 270 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 288 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 312 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 324 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 342 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 378 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 384 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 396 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 12.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 216 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 228 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 246 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 258 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 276 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 288 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 294 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 300 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 306 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 354 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 366 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 390 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 402 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 432 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 168 .75 6 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@decorator) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (', ') Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (join) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg (') Tj /F3 10 Tf .733333 .4 .533333 rg (%r) Tj /F4 10 Tf .729412 .129412 .129412 rg (: ) Tj /F3 10 Tf .733333 .4 .533333 rg (%r) Tj /F4 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (k) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg ([) Tj 0 0 0 rg (k) Tj 0 0 0 rg (]\)) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (for) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (k) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (sorted) Tj 0 0 0 rg (\() Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("calling ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg ( with args ) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (, {) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (}") Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwstr) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 492.8236 cm
-q
-BT 1 0 0 1 0 14 Tm 1.806654 Tw 12 TL /F1 10 Tf 0 0 0 rg (and now ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (will be a decorator. Actually ) Tj /F4 10 Tf 0 0 0 rg (trace ) Tj /F1 10 Tf 0 0 0 rg (is a ) Tj /F4 10 Tf 0 0 0 rg (partial ) Tj /F1 10 Tf 0 0 0 rg (object which can be used as a) Tj T* 0 Tw (decorator:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 447.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 96 .75 12 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (function) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (at) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (x) Tj .4 .4 .4 rg (...) Tj (>) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 427.6236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is an example of usage:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 346.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 72 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 12 12 re f*
-BT 1 0 0 1 0 50 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (calling) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\(\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 314.4236 cm
-q
-BT 1 0 0 1 0 14 Tm 2.44686 Tw 12 TL /F1 10 Tf 0 0 0 rg (If you are using an old Python version \(Python 2.4\) the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module provides a poor man) Tj T* 0 Tw (replacement for ) Tj /F4 10 Tf 0 0 0 rg (functools.partial) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 281.4236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (blocking) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 239.4236 cm
-q
-BT 1 0 0 1 0 26 Tm 1.224692 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes one has to deal with blocking resources, such as ) Tj /F4 10 Tf 0 0 0 rg (stdin) Tj /F1 10 Tf 0 0 0 rg (, and sometimes it is best to have) Tj T* 0 Tw .266235 Tw (back a "busy" message than to block everything. This behavior can be implemented with a suitable family) Tj T* 0 Tw (of decorators, where the parameter is the busy message:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 86.22362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 144 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 120.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 120.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 120.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 132 120.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 108.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 96 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 150 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 174 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 186 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 90 96.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 132 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 96.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 204 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 228 96.75 114 12 re f*
-.960784 .960784 .862745 rg
-n 72 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 84.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 156 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 72.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 150 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 204 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 72.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 228 72.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 240 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 126 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 60.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 192 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 234 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 240 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 264 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 60.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 336 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 48.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 120 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 156 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 36.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 174 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 282 12 re f*
-BT 1 0 0 1 0 122 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (blocking) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (not) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (hasattr) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("thread") Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# no thread running) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (set_result) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (set_result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (elif) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (isAlive) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (not_avail) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the thread is ended, return the stored result) Tj /F4 10 Tf 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-99 0 obj
-<< /Length 13880 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 715.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 72 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 48 12 re f*
-.960784 .960784 .862745 rg
-n 174 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (del) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (thread) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (blocking) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 683.8236 cm
-q
-BT 1 0 0 1 0 14 Tm 1.010651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Functions decorated with ) Tj /F4 10 Tf 0 0 0 rg (blocking ) Tj /F1 10 Tf 0 0 0 rg (will return a busy message if the resource is unavailable, and the) Tj T* 0 Tw (intended result if the resource is available. For instance:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 434.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 240 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 216.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 78 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 216.75 102 12 re f*
-.960784 .960784 .862745 rg
-n 186 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 204.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 204.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 204.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 102 204.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 192.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 192.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 192.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 108 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 192.75 180 12 re f*
-.960784 .960784 .862745 rg
-n 0 180.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 180.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 180.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 0 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 156.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 156.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 156.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 144 156.75 162 12 re f*
-.960784 .960784 .862745 rg
-n 0 144.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 42 144.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 144.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 120.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 120.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 108.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 108.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 144 108.75 162 12 re f*
-.960784 .960784 .862745 rg
-n 0 96.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 42 96.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 60.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 144 60.75 162 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 42 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 108 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 228 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 30 .75 24 12 re f*
-BT 1 0 0 1 0 218 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@blocking) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("Please wait ...") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (read_data) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# simulate a blocking resource) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("some data") Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# data is not available yet) Tj /F4 10 Tf 0 0 0 rg T* 0 0 0 rg (Please) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (wait) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1.1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# after 3.1 seconds, data is available) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (read_data) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* 0 0 0 rg (some) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (data) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 401.6236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F3 17.5 Tf 0 0 0 rg (async) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 359.6236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL 1.647485 Tw (We have just seen an examples of a simple decorator factory, implemented as a function returning a) Tj T* 0 Tw .29784 Tw (decorator. For more complex situations, it is more convenient to implement decorator factories as classes) Tj T* 0 Tw (returning callable objects that can be converted into decorators.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 293.6236 cm
-q
-BT 1 0 0 1 0 50 Tm 2.853876 Tw 12 TL /F1 10 Tf 0 0 0 rg (As an example, here will I show a decorator which is able to convert a blocking function into an) Tj T* 0 Tw 2.477126 Tw (asynchronous function. The function, when called, is executed in a separate thread. Moreover, it is) Tj T* 0 Tw .288443 Tw (possible to set three callbacks ) Tj /F4 10 Tf 0 0 0 rg (on_success) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (on_failure ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (on_closing) Tj /F1 10 Tf 0 0 0 rg (, to specify how to manage) Tj T* 0 Tw 1.854724 Tw (the function call \(of course the code here is just an example, it is not a recommended way of doing) Tj T* 0 Tw (multi-threaded programming\). The implementation is the following:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 236.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 228 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 36 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called on the result of the function") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 179.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 24.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 180 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called if the function fails") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 122.0236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 114 24.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 336 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 24 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (on_closing) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# default implementation) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("Called at the end, both in case of success and failure") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-100 0 obj
-<< /Length 19866 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 331.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 432 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 408.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 36 408.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 66 408.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 408.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 108 408.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 396.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 384.75 378 12 re f*
-.960784 .960784 .862745 rg
-n 0 372.75 330 12 re f*
-.960784 .960784 .862745 rg
-n 0 360.75 0 12 re f*
-.960784 .960784 .862745 rg
-n 0 348.75 294 12 re f*
-.960784 .960784 .862745 rg
-n 0 336.75 348 12 re f*
-.960784 .960784 .862745 rg
-n 0 324.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 24 300.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 300.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 96 300.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 300.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 300.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 300.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 216 300.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 300.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 288 300.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 294 300.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 354 300.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 288.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 162 288.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 288.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 228 288.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 240 288.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 300 288.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 306 288.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 366 288.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 276.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 276.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 276.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 162 276.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 276.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 48 264.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 264.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 264.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 144 264.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 264.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 48 252.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 252.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 252.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 144 252.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 252.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 48 240.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 240.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 240.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 144 240.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 240.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 24 216.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 216.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 96 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 216.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 216.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 162 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 216.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 204 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 216.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 228 216.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 240 216.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 204.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 66 204.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 192.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 120 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 192.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 156 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 192.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 48 180.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 180.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 174 180.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 192 180.75 258 12 re f*
-.960784 .960784 .862745 rg
-n 72 168.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 120 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 168.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 156 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 168.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 210 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 168.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 276 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 282 168.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 312 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 318 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 324 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 78 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 156.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 108 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 156.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 126 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 180 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 156.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 234 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 246 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 270 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 276 156.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 318 156.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 132.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 132.75 72 12 re f*
-.960784 .960784 .862745 rg
-n 144 132.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 120.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 90 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 108.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 138 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 174 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 210 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 234 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 246 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 108 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 84.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 186 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 192 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 210 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 84.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 264 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 138 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 162 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 60.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 228 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 234 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 270 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 114 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 186 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 24.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 210 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 240 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 24.75 72 12 re f*
-.960784 .960784 .862745 rg
-n 324 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 336 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 360 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 84 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 36 12 re f*
-BT 1 0 0 1 0 410 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (Async) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( A decorator converting blocking functions into asynchronous) Tj T* ( functions, by using threads or processes. Examples:) Tj T* T* ( async_with_threads = Async\(threading.Thread\)) Tj T* ( async_with_processes = Async\(multiprocessing.Process\)) Tj T* ( """) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (on_failure) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (except) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf .823529 .254902 .227451 rg (AttributeError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# instantiate the counter at the first call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (counter) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (itertools) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (count) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (') Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (-) Tj /F3 10 Tf .733333 .4 .533333 rg (%s) Tj /F4 10 Tf .729412 .129412 .129412 rg (') Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (%) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__name__) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (next) Tj 0 0 0 rg (\() Tj 0 0 0 rg (counter) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (func_wrapper) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (except) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_failure) Tj 0 0 0 rg (\() Tj 0 0 0 rg (sys) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (exc_info) Tj 0 0 0 rg (\(\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_success) Tj 0 0 0 rg (\() Tj 0 0 0 rg (result) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (finally) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (on_closing) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (threadfactory) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (None) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func_wrapper) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (name) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (thread) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (start) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (thread) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 299.8236 cm
-q
-BT 1 0 0 1 0 14 Tm .865984 Tw 12 TL /F1 10 Tf 0 0 0 rg (The decorated function returns the current execution thread, which can be stored and checked later, for) Tj T* 0 Tw (instance to verify that the thread ) Tj /F4 10 Tf 0 0 0 rg (.isAlive\(\)) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 257.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F1 10 Tf 12 TL .691654 Tw (Here is an example of usage. Suppose one wants to write some data to an external resource which can) Tj T* 0 Tw .21683 Tw (be accessed by a single user at once \(for instance a printer\). Then the access to the writing function must) Tj T* 0 Tw (be locked. Here is a minimalistic example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 104.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 144 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 120.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 60 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 120.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 126 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 120.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 162 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 120.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 222 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 120.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 264 120.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 78 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 108 96.75 342 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 48.75 240 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 78 36.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 132 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 162 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 24.75 222 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 192 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 264 12 re f*
-BT 1 0 0 1 0 122 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (async) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (decorator) Tj 0 0 0 rg (\() Tj 0 0 0 rg (Async) Tj 0 0 0 rg (\() Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ([]) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# for simplicity the written data are stored into a list.) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@async) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (write) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# append data to the datalist by locking) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (threading) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (Lock) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# emulate some long running operation) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (datalist) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (append) Tj 0 0 0 rg (\() Tj 0 0 0 rg (data) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# other operations not requiring a lock here) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-101 0 obj
-<< /Length 16154 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 741.0236 cm
-q
-BT 1 0 0 1 0 14 Tm .905868 Tw 12 TL /F1 10 Tf 0 0 0 rg (Each call to ) Tj /F4 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (will create a new writer thread, but there will be no synchronization problems since) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (write ) Tj /F1 10 Tf 0 0 0 rg (is locked.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 575.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 156 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 132.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 132.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 120.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 42 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 120.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 120.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 144 120.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 162 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 96.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 96.75 342 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 72.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 60.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 144 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 162 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 36.75 204 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-BT 1 0 0 1 0 134 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data1") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (.) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait a bit, so we are sure data2 is written after data1) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (write) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ("data2") Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (Thread) Tj 0 0 0 rg (\() Tj 0 0 0 rg (write) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (started) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg (\)) Tj .4 .4 .4 rg (>) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (time) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (sleep) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# wait for the writers to complete) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (datalist) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg ([) Tj .729412 .129412 .129412 rg ('data1') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('data2') Tj 0 0 0 rg (]) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 542.8236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (contextmanager) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 512.8236 cm
-q
-BT 1 0 0 1 0 14 Tm 2.685984 Tw 12 TL /F1 10 Tf 0 0 0 rg (For a long time Python had in its standard library a ) Tj /F4 10 Tf 0 0 0 rg (contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator, able to convert) Tj T* 0 Tw (generator functions into ) Tj /F4 10 Tf 0 0 0 rg (_GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (factories. For instance if you write) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 419.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 84 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 60.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 120 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 162 60.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 72 12 re f*
-.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 204 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 120 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (from) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (contextlib) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (import) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@contextmanager) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (before_after) Tj 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (after) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (before) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (yield) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (after) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 387.6236 cm
-q
-BT 1 0 0 1 0 14 Tm .955976 Tw 12 TL /F1 10 Tf 0 0 0 rg (then ) Tj /F4 10 Tf 0 0 0 rg (before_after ) Tj /F1 10 Tf 0 0 0 rg (is a factory function returning ) Tj /F4 10 Tf 0 0 0 rg (_GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects which can) Tj T* 0 Tw (be used with the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 270.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 84.75 72 12 re f*
-.960784 .960784 .862745 rg
-n 126 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 84.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 180 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 192 84.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 234 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 72.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 108 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 60.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 258 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 54 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 30 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (ba) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (before_after) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('BEFORE') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('AFTER') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (type) Tj 0 0 0 rg (\() Tj 0 0 0 rg (ba) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (') Tj /F3 10 Tf 0 0 1 rg (contextlib) Tj /F4 10 Tf .4 .4 .4 rg (.) Tj 0 0 0 rg (_GeneratorContextManager) Tj .729412 .129412 .129412 rg (') Tj (>) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (with) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (ba) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 226.4236 cm
-q
-BT 1 0 0 1 0 26 Tm .462488 Tw 12 TL /F1 10 Tf 0 0 0 rg (Basically, it is as if the content of the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (block was executed in the place of the ) Tj /F4 10 Tf 0 0 0 rg (yield ) Tj /F1 10 Tf 0 0 0 rg (expression in) Tj T* 0 Tw 2.146342 Tw (the generator function. In Python 3.2 ) Tj /F4 10 Tf 0 0 0 rg (_GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects were enhanced with a) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (__call__ ) Tj /F1 10 Tf 0 0 0 rg (method, so that they can be used as decorators as in this example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 109.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 60.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 126 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 30 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@ba) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (hello) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('hello') Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (hello) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (BEFORE) Tj 0 0 0 rg T* 0 0 0 rg (hello) Tj 0 0 0 rg T* 0 0 0 rg (AFTER) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 77.22362 cm
-q
-BT 1 0 0 1 0 14 Tm .20561 Tw 12 TL /F1 10 Tf 0 0 0 rg (The ) Tj /F4 10 Tf 0 0 0 rg (ba ) Tj /F1 10 Tf 0 0 0 rg (decorator is basically inserting a ) Tj /F4 10 Tf 0 0 0 rg (with) Tj ( ) Tj (ba: ) Tj /F1 10 Tf 0 0 0 rg (block inside the function. However there two issues: ) Tj T* 0 Tw .973555 Tw (the first is that ) Tj /F4 10 Tf 0 0 0 rg (_GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (objects are callable only in Python 3.2, so the previous) Tj T* 0 Tw ET
-Q
-Q
-
-endstream
-endobj
-102 0 obj
-<< /Length 14666 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 669.0236 cm
-q
-BT 1 0 0 1 0 86 Tm 2.758314 Tw 12 TL /F1 10 Tf 0 0 0 rg (example will break in older versions of Python; the second is that ) Tj /F4 10 Tf 0 0 0 rg (_GeneratorContextManager) Tj T* 0 Tw .503318 Tw /F1 10 Tf 0 0 0 rg (objects do not preserve the signature of the decorated functions: the decorated ) Tj /F4 10 Tf 0 0 0 rg (hello ) Tj /F1 10 Tf 0 0 0 rg (function here will) Tj T* 0 Tw 1.07784 Tw (have a generic signature ) Tj /F4 10 Tf 0 0 0 rg (hello\(*args,) Tj ( ) Tj (**kwargs\) ) Tj /F1 10 Tf 0 0 0 rg (but will break when called with more than zero) Tj T* 0 Tw 7.708314 Tw (arguments. For such reasons the decorator module, starting with release 3.4, offers a) Tj T* 0 Tw .616647 Tw /F4 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (decorator that solves both problems and works even in Python 2.5. The) Tj T* 0 Tw .34998 Tw (usage is the same and factories decorated with ) Tj /F4 10 Tf 0 0 0 rg (decorator.contextmanager ) Tj /F1 10 Tf 0 0 0 rg (will returns instances of) Tj T* 0 Tw 3.295681 Tw /F4 10 Tf 0 0 0 rg (ContextManager) Tj /F1 10 Tf 0 0 0 rg (, a subclass of ) Tj /F4 10 Tf 0 0 0 rg (contextlib._GeneratorContextManager ) Tj /F1 10 Tf 0 0 0 rg (with a ) Tj /F4 10 Tf 0 0 0 rg (__call__) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (method acting as a signature-preserving decorator.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 636.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (The ) Tj /F3 17.5 Tf 0 0 0 rg (FunctionMaker ) Tj /F2 17.5 Tf 0 0 0 rg (class) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 570.0236 cm
-q
-BT 1 0 0 1 0 50 Tm 2.241412 Tw 12 TL /F1 10 Tf 0 0 0 rg (You may wonder about how the functionality of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is implemented. The basic) Tj T* 0 Tw 1.545868 Tw (building block is a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class which is able to generate on the fly functions with a given) Tj T* 0 Tw .047485 Tw (name and signature from a function template passed as a string. Generally speaking, you should not need) Tj T* 0 Tw 1.164983 Tw (to resort to ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (when writing ordinary decorators, but it is handy in some circumstances.) Tj T* 0 Tw (You will see an example shortly, in the implementation of a cool decorator utility \() Tj /F4 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (\).) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 528.0236 cm
-q
-BT 1 0 0 1 0 26 Tm .414597 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (provides a ) Tj /F4 10 Tf 0 0 0 rg (.create ) Tj /F1 10 Tf 0 0 0 rg (classmethod which takes as input the name, signature, and body) Tj T* 0 Tw .632927 Tw (of the function we want to generate as well as the execution environment were the function is generated) Tj T* 0 Tw (by ) Tj /F4 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. Here is an example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 434.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 84 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 114 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 126 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 144 60.75 222 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 78 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 132 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 132 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 174 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 240 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 24.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 306 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 318 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 342 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 348 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 354 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 360 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 366 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 .75 12 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# a function with a generic signature) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* 0 0 0 rg (\() Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj 0 0 0 rg ({}) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 402.8236 cm
-q
-BT 1 0 0 1 0 14 Tm .226654 Tw 12 TL /F1 10 Tf 0 0 0 rg (It is important to notice that the function body is interpolated before being executed, so be careful with the) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (% ) Tj /F1 10 Tf 0 0 0 rg (sign!) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 360.8236 cm
-q
-BT 1 0 0 1 0 26 Tm 1.995433 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (also accepts keyword arguments and such arguments are attached to the) Tj T* 0 Tw 1.64686 Tw (resulting function. This is useful if you want to set some function attributes, for instance the docstring) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (__doc__) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 318.8236 cm
-q
-BT 1 0 0 1 0 26 Tm .605318 Tw 12 TL /F1 10 Tf 0 0 0 rg (For debugging/introspection purposes it may be useful to see the source code of the generated function;) Tj T* 0 Tw 2.246235 Tw (to do that, just pass the flag ) Tj /F4 10 Tf 0 0 0 rg (addsource=True ) Tj /F1 10 Tf 0 0 0 rg (and a ) Tj /F4 10 Tf 0 0 0 rg (__source__ ) Tj /F1 10 Tf 0 0 0 rg (attribute will be added to the) Tj T* 0 Tw (generated function:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 225.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 84 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 60.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 132 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 174 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 48.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 108 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 48.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 174 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 186 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 210 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 222 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 234 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 252 48.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 306 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 312 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 336 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 36.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 138 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 36 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f1\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('f\(a, b\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (addsource) Tj .4 .4 .4 rg (=) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (f1) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__source__) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f1) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (a) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (b) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 85.62362 cm
-q
-BT 1 0 0 1 0 122 Tm .870651 Tw 12 TL /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (can take as first argument a string, as in the examples before, or a function.) Tj T* 0 Tw .224985 Tw (This is the most common usage, since typically you want to decorate a pre-existing function. A framework) Tj T* 0 Tw 1.606136 Tw (author may want to use directly ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (instead of ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (, since it gives you) Tj T* 0 Tw 1.36686 Tw (direct access to the body of the generated function. For instance, suppose you want to instrument the) Tj T* 0 Tw .372209 Tw /F4 10 Tf 0 0 0 rg (__init__ ) Tj /F1 10 Tf 0 0 0 rg (methods of a set of classes, by preserving their signature \(such use case is not made up; this) Tj T* 0 Tw .673828 Tw (is done in SQAlchemy and in other frameworks\). When the first argument of ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create) Tj T* 0 Tw 3.405814 Tw /F1 10 Tf 0 0 0 rg (is a function, a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (object is instantiated internally, with attributes ) Tj /F4 10 Tf 0 0 0 rg (args) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (varargs) Tj /F1 10 Tf 0 0 0 rg (,) Tj T* 0 Tw 5.509982 Tw /F4 10 Tf 0 0 0 rg (keywords ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (defaults ) Tj /F1 10 Tf 0 0 0 rg (which are the the return values of the standard library function) Tj T* 0 Tw .561318 Tw /F4 10 Tf 0 0 0 rg (inspect.getargspec) Tj /F1 10 Tf 0 0 0 rg (. For each argument in the ) Tj /F4 10 Tf 0 0 0 rg (args ) Tj /F1 10 Tf 0 0 0 rg (\(which is a list of strings containing the names) Tj T* 0 Tw 1.599985 Tw (of the mandatory arguments\) an attribute ) Tj /F4 10 Tf 0 0 0 rg (arg0) Tj /F1 10 Tf 0 0 0 rg (, ) Tj /F4 10 Tf 0 0 0 rg (arg1) Tj /F1 10 Tf 0 0 0 rg (, ..., ) Tj /F4 10 Tf 0 0 0 rg (argN ) Tj /F1 10 Tf 0 0 0 rg (is also generated. Finally, there is a) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (signature ) Tj /F1 10 Tf 0 0 0 rg (attribute, a string with the signature of the original function.) Tj T* ET
-Q
-Q
-
-endstream
-endobj
-103 0 obj
-<< /Length 14039 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 693.0236 cm
-q
-BT 1 0 0 1 0 62 Tm 4.63311 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that while I do not have plans to change or remove the functionality provided in the) Tj T* 0 Tw 1.00936 Tw /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (class, I do not guarantee that it will stay unchanged forever. For instance, right now I) Tj T* 0 Tw .791318 Tw (am using the traditional string interpolation syntax for function templates, but Python 2.6 and Python 3.0) Tj T* 0 Tw .712093 Tw (provide a newer interpolation syntax and I may use the new syntax in the future. On the other hand, the) Tj T* 0 Tw .639985 Tw (functionality provided by ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (has been there from version 0.1 and it is guaranteed to stay there) Tj T* 0 Tw (forever.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 660.0236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Getting the source code) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 582.0236 cm
-q
-BT 1 0 0 1 0 62 Tm 5.045529 Tw 12 TL /F1 10 Tf 0 0 0 rg (Internally ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker.create ) Tj /F1 10 Tf 0 0 0 rg (uses ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Therefore) Tj T* 0 Tw 2.542126 Tw /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (will not work for decorated functions. That means that the usual '??' trick in) Tj T* 0 Tw 26.45775 Tw (IPython will give you the \(right on the spot\) message) Tj T* 0 Tw .261647 Tw /F4 10 Tf 0 0 0 rg (Dynamically) Tj ( ) Tj (generated) Tj ( ) Tj (function.) Tj ( ) Tj (No) Tj ( ) Tj (source) Tj ( ) Tj (code available) Tj /F1 10 Tf 0 0 0 rg (. In the past I have considered) Tj T* 0 Tw .945366 Tw (this acceptable, since ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (does not really work even with regular decorators. In that) Tj T* 0 Tw (case ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (gives you the wrapper source code which is probably not what you want:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 512.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 72 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 174 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 42 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (identity_dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (wrapper) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 407.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 96 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 72.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 66 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 90 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 36.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 210 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 174 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 74 Tm 12 TL /F4 10 Tf .666667 .133333 1 rg (@identity_dec) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (example) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (example) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (wrapper) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 351.6236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.471235 Tw 12 TL /F1 10 Tf 0 0 0 rg (\(see bug report ) Tj 0 0 .501961 rg (1764286 ) Tj 0 0 0 rg (for an explanation of what is happening\). Unfortunately the bug is still there,) Tj T* 0 Tw 1.541235 Tw (even in Python 2.7 and 3.1. There is however a workaround. The decorator module adds an attribute) Tj T* 0 Tw .103984 Tw /F4 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (to the decorated function, containing a reference to the original function. The easy way to) Tj T* 0 Tw (get the source code is to call ) Tj /F4 10 Tf 0 0 0 rg (inspect.getsource ) Tj /F1 10 Tf 0 0 0 rg (on the undecorated function:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 234.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 84.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 102 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 84.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 162 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 84.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 222 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 228 84.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 294 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 60.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 78 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 120 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 72 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (inspect) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (getsource) Tj 0 0 0 rg (\() Tj 0 0 0 rg (factorial) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (__wrapped__) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (<) Tj 0 0 0 rg (BLANKLINE) Tj .4 .4 .4 rg (>) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 201.4236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Dealing with third party decorators) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 147.4236 cm
-q
-BT 1 0 0 1 0 38 Tm .321654 Tw 12 TL /F1 10 Tf 0 0 0 rg (Sometimes you find on the net some cool decorator that you would like to include in your code. However,) Tj T* 0 Tw .50061 Tw (more often than not the cool decorator is not signature-preserving. Therefore you may want an easy way) Tj T* 0 Tw 1.814597 Tw (to upgrade third party decorators to signature-preserving decorators without having to rewrite them in) Tj T* 0 Tw (terms of ) Tj /F4 10 Tf 0 0 0 rg (decorator) Tj /F1 10 Tf 0 0 0 rg (. You can use a ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker ) Tj /F1 10 Tf 0 0 0 rg (to implement that functionality as follows:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 78.22362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 114 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 138 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 174 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 378 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 264 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (dec) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( Decorate a function by preserving the signature even if dec) Tj T* ( is not a signature-preserving decorator.) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-104 0 obj
-<< /Length 16120 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 703.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 144 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 186 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 12.75 108 12 re f*
-.960784 .960784 .862745 rg
-n 192 12.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 270 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 282 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 186 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 210 .75 66 12 re f*
-.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 282 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 306 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F6 10 Tf .729412 .129412 .129412 rg ( """) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (FunctionMaker) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (create) Tj 0 0 0 rg (\() Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ('return decorated\() Tj /F3 10 Tf .733333 .4 .533333 rg (%\(signature\)s) Tj /F4 10 Tf .729412 .129412 .129412 rg (\)') Tj 0 0 0 rg (,) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (dict) Tj 0 0 0 rg (\() Tj 0 0 0 rg (decorated) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (dec) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)\),) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (__wrapped__) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 671.8236 cm
-q
-BT 1 0 0 1 0 14 Tm .698314 Tw 12 TL /F4 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (sets the attribute ) Tj /F4 10 Tf 0 0 0 rg (.__wrapped__ ) Tj /F1 10 Tf 0 0 0 rg (of the generated function to the original function,) Tj T* 0 Tw (so that you can get the right source code.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 629.8236 cm
-q
-BT 1 0 0 1 0 26 Tm .13104 Tw 12 TL /F1 10 Tf 0 0 0 rg (Notice that I am not providing this functionality in the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module directly since I think it is best to) Tj T* 0 Tw 2.070751 Tw (rewrite the decorator rather than adding an additional level of indirection. However, practicality beats) Tj T* 0 Tw (purity, so you can add ) Tj /F4 10 Tf 0 0 0 rg (decorator_apply ) Tj /F1 10 Tf 0 0 0 rg (to your toolbox and use it if you need to.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 575.8236 cm
-q
-BT 1 0 0 1 0 38 Tm 1.74881 Tw 12 TL /F1 10 Tf 0 0 0 rg (In order to give an example of usage of ) Tj /F4 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (, I will show a pretty slick decorator that) Tj T* 0 Tw 1.276651 Tw (converts a tail-recursive function in an iterative function. I have shamelessly stolen the basic idea from) Tj T* 0 Tw 43.62829 Tw (Kay Schluehr's recipe in the Python Cookbook,) Tj T* 0 Tw 0 0 .501961 rg (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj 0 0 0 rg (.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 206.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 360 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 336.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 36 336.75 78 12 re f*
-.960784 .960784 .862745 rg
-n 114 336.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 336.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 156 336.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 324.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 312.75 354 12 re f*
-.960784 .960784 .862745 rg
-n 0 300.75 396 12 re f*
-.960784 .960784 .862745 rg
-n 0 288.75 276 12 re f*
-.960784 .960784 .862745 rg
-n 0 276.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 24 252.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 252.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 96 252.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 252.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 252.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 252.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 162 252.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 240.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 240.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 240.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 240.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 240.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 228.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 228.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 228.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 138 228.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 228.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 216.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 216.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 132 216.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 216.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 180 216.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 204 216.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 24 192.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 192.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 96 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 192.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 192.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 192.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 192.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 192 192.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 210 192.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 48 180.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 102 180.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 180.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 138 180.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 180.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 48 168.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 66 168.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 90 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 168.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 150 168.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 102 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 138 156.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 156.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 144.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 144.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 144.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 162 144.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 144.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 72 132.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 90 132.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 120.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 132 120.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 156 120.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 108.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 162 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 174 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 198 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 210 108.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 234 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 246 108.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 258 108.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 276 108.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 138 96.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 180 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 198 96.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 246 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 96.75 108 12 re f*
-.960784 .960784 .862745 rg
-n 144 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 84.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 204 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 240 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 246 84.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 120 72.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 144 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 72.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 144 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 186 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 114 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 120 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 186 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 24.75 234 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 12.75 42 12 re f*
-.960784 .960784 .862745 rg
-n 150 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 186 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 48 12 re f*
-BT 1 0 0 1 0 338 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (class) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F3 10 Tf 0 0 1 rg (TailRecursive) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F6 10 Tf .729412 .129412 .129412 rg (""") Tj T* ( tail_recursive decorator based on Kay Schluehr's recipe) Tj T* ( http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691) Tj T* ( with improvements by me and George Sakkis.) Tj T* ( """) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__init__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (object) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# sentinel) Tj /F4 10 Tf 0 0 0 rg T* T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (__call__) Tj 0 0 0 rg (\() Tj 0 .501961 0 rg (self) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (func) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (False) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (try) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (while) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (is) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# update arguments) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# last call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (result) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (finally) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (firstcall) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 .501961 0 rg (True) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (else) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# return the arguments of the tail call) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj 0 .501961 0 rg (self) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (argskwd) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (kwd) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (CONTINUE) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 186.6236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here the decorator is implemented as a class returning callable objects.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 141.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 108 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 138 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 90 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 78 12 re f*
-.960784 .960784 .862745 rg
-n 240 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 276 .75 6 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (tail_recursive) Tj 0 0 0 rg (\() Tj 0 0 0 rg (func) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (decorator_apply) Tj 0 0 0 rg (\() Tj 0 0 0 rg (TailRecursive) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (func) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 121.4236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Here is how you apply the upgraded decorator to the good old factorial:) Tj T* ET
-Q
-Q
-
-endstream
-endobj
-105 0 obj
-<< /Length 8282 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 679.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 84 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 60.75 90 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 78 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 48.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 120 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 54 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 162 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 186 .75 6 12 re f*
-BT 1 0 0 1 0 62 Tm 12 TL /F4 10 Tf .666667 .133333 1 rg (@tail_recursive) Tj 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj .4 .4 .4 rg (=) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .729412 .129412 .129412 rg ("The good old factorial") Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (acc) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (acc) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 634.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 12.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 114 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 12 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (factorial) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (\)\)) Tj 0 0 0 rg T* .4 .4 .4 rg (24) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 578.6236 cm
-q
-BT 1 0 0 1 0 38 Tm .188935 Tw 12 TL /F1 10 Tf 0 0 0 rg (This decorator is pretty impressive, and should give you some food for your mind ;\) Notice that there is no) Tj T* 0 Tw 1.339983 Tw (recursion limit now, and you can easily compute ) Tj /F4 10 Tf 0 0 0 rg (factorial\(1001\) ) Tj /F1 10 Tf 0 0 0 rg (or larger without filling the stack) Tj T* 0 Tw .909431 Tw (frame. Notice also that the decorator will not work on functions which are not tail recursive, such as the) Tj T* 0 Tw (following) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 509.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 60 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 48 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 168 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 42 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 90 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 .75 24 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 .75 6 12 re f*
-BT 1 0 0 1 0 38 Tm 12 TL /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# this is not tail-recursive) Tj /F4 10 Tf 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (if) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (==) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg (:) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (n) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (*) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (fact) Tj 0 0 0 rg (\() Tj 0 0 0 rg (n) Tj .4 .4 .4 rg (-) Tj .4 .4 .4 rg (1) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 477.4236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .541098 Tw (\(reminder: a function is tail recursive if it either returns a value without making a recursive call, or returns) Tj T* 0 Tw (directly the result of a recursive call\).) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 444.4236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Caveats and limitations) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 414.4236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .474987 Tw (The first thing you should be aware of, it the fact that decorators have a performance penalty. The worse) Tj T* 0 Tw (case is shown by the following example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 189.2236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 216 re B*
-Q
-q
-0 0 0 rg
-BT 1 0 0 1 0 194 Tm /F4 10 Tf 12 TL ($ cat performance.sh) Tj T* (python3 -m timeit -s ") Tj T* (from decorator import decorator) Tj T* T* (@decorator) Tj T* (def do_nothing\(func, *args, **kw\):) Tj T* ( return func\(*args, **kw\)) Tj T* T* (@do_nothing) Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* T* (python3 -m timeit -s ") Tj T* (def f\(\):) Tj T* ( pass) Tj T* (" "f\(\)") Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 157.2236 cm
-q
-BT 1 0 0 1 0 14 Tm .266235 Tw 12 TL /F1 10 Tf 0 0 0 rg (On my MacBook, using the ) Tj /F4 10 Tf 0 0 0 rg (do_nothing ) Tj /F1 10 Tf 0 0 0 rg (decorator instead of the plain function is more than three times) Tj T* 0 Tw (slower:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 100.0236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-0 0 0 rg
-BT 1 0 0 1 0 26 Tm /F4 10 Tf 12 TL ($ bash performance.sh) Tj T* (1000000 loops, best of 3: 0.669 usec per loop) Tj T* (1000000 loops, best of 3: 0.181 usec per loop) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-106 0 obj
-<< /Length 16078 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 729.0236 cm
-q
-BT 1 0 0 1 0 26 Tm 1.25832 Tw 12 TL /F1 10 Tf 0 0 0 rg (It should be noted that a real life function would probably do something more useful than ) Tj /F4 10 Tf 0 0 0 rg (f ) Tj /F1 10 Tf 0 0 0 rg (here, and) Tj T* 0 Tw .91811 Tw (therefore in real life the performance penalty could be completely negligible. As always, the only way to) Tj T* 0 Tw (know if there is a penalty in your specific use case is to measure it.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 699.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .867984 Tw (You should be aware that decorators will make your tracebacks longer and more difficult to understand.) Tj T* 0 Tw (Consider this example:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 641.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 48 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 .75 6 12 re f*
-BT 1 0 0 1 0 26 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 609.8236 cm
-q
-BT 1 0 0 1 0 14 Tm .583318 Tw 12 TL /F1 10 Tf 0 0 0 rg (Calling ) Tj /F4 10 Tf 0 0 0 rg (f\(\) ) Tj /F1 10 Tf 0 0 0 rg (will give you a ) Tj /F4 10 Tf 0 0 0 rg (ZeroDivisionError) Tj /F1 10 Tf 0 0 0 rg (, but since the function is decorated the traceback will) Tj T* 0 Tw (be longer:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 480.6236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 120 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 96.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 84.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 84.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 138 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 84.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 192 84.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 30 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 60 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 60.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 108 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 120 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 60.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 162 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 168 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 180 60.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 198 60.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 120 12 re f*
-.960784 .960784 .862745 rg
-n 192 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 246 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 282 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 42 36.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 84 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 96 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 102 36.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 126 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 138 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 150 36.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 162 36.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 60 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 120 12 re f*
-.960784 .960784 .862745 rg
-n 192 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 198 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 204 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 216 24.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 246 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 252 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 264 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 282 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 42 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 102 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 114 .75 18 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\(\)) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (string) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (2) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[22]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (4) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg (\() Tj .4 .4 .4 rg (*) Tj 0 0 0 rg (args) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (**) Tj 0 0 0 rg (kw) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* ( ) Tj 0 0 0 rg (File) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg (") Tj (<) Tj (doctest __main__[51]) Tj (>) Tj (") Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (line) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (3) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (1) Tj .4 .4 .4 rg (/) Tj .4 .4 .4 rg (0) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (ZeroDivisionError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (...) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 412.6236 cm
-q
-BT 1 0 0 1 0 50 Tm 1.05528 Tw 12 TL /F1 10 Tf 0 0 0 rg (You see here the inner call to the decorator ) Tj /F4 10 Tf 0 0 0 rg (trace) Tj /F1 10 Tf 0 0 0 rg (, which calls ) Tj /F4 10 Tf 0 0 0 rg (f\(*args,) Tj ( ) Tj (**kw\)) Tj /F1 10 Tf 0 0 0 rg (, and a reference to) Tj T* 0 Tw .076457 Tw /F4 10 Tf 0 0 0 rg (File) Tj ( ) Tj (") Tj (<) Tj (string) Tj (>) Tj (",) Tj ( ) Tj (line) Tj ( ) Tj (2,) Tj ( ) Tj (in) Tj ( ) Tj (f) Tj /F1 10 Tf 0 0 0 rg (. This latter reference is due to the fact that internally the decorator) Tj T* 0 Tw 2.053318 Tw (module uses ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (to generate the decorated function. Notice that ) Tj /F4 10 Tf 0 0 0 rg (exec ) Tj /F1 10 Tf 0 0 0 rg (is ) Tj /F5 10 Tf (not ) Tj /F1 10 Tf (responsibile for the) Tj T* 0 Tw 1.507485 Tw (performance penalty, since is the called ) Tj /F5 10 Tf (only once ) Tj /F1 10 Tf (at function decoration time, and not every time the) Tj T* 0 Tw (decorated function is called.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 334.6236 cm
-q
-BT 1 0 0 1 0 62 Tm .932209 Tw 12 TL /F1 10 Tf 0 0 0 rg (At present, there is no clean way to avoid ) Tj /F4 10 Tf 0 0 0 rg (exec) Tj /F1 10 Tf 0 0 0 rg (. A clean solution would require to change the CPython) Tj T* 0 Tw .777485 Tw (implementation of functions and add an hook to make it possible to change their signature directly. That) Tj T* 0 Tw .74186 Tw (could happen in future versions of Python \(see PEP ) Tj 0 0 .501961 rg (362) Tj 0 0 0 rg (\) and then the decorator module would become) Tj T* 0 Tw 2.385318 Tw (obsolete. However, at present, even in Python 3.2 it is impossible to change the function signature) Tj T* 0 Tw .931751 Tw (directly, therefore the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module is still useful. Actually, this is one of the main reasons why I) Tj T* 0 Tw (keep maintaining the module and releasing new versions.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 292.6236 cm
-q
-BT 1 0 0 1 0 26 Tm 1.043828 Tw 12 TL /F1 10 Tf 0 0 0 rg (In the present implementation, decorators generated by ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (can only be used on user-defined) Tj T* 0 Tw .152485 Tw (Python functions or methods, not on generic callable objects, nor on built-in functions, due to limitations of) Tj T* 0 Tw (the ) Tj /F4 10 Tf 0 0 0 rg (inspect ) Tj /F1 10 Tf 0 0 0 rg (module in the standard library.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 262.6236 cm
-q
-BT 1 0 0 1 0 14 Tm .785777 Tw 12 TL /F1 10 Tf 0 0 0 rg (There is a restriction on the names of the arguments: for instance, if try to call an argument ) Tj /F4 10 Tf 0 0 0 rg (_call_ ) Tj /F1 10 Tf 0 0 0 rg (or) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (_func_ ) Tj /F1 10 Tf 0 0 0 rg (you will get a ) Tj /F4 10 Tf 0 0 0 rg (NameError) Tj /F1 10 Tf 0 0 0 rg (:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 145.4236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 108 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 84.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 84.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 60 72.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 96 72.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 114 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 144 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 150 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 0 60.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 60 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 96 48.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 138 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 168 48.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 192 48.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 12 36.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 54 12 re f*
-.960784 .960784 .862745 rg
-n 54 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 66 24.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 108 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 60 12 re f*
-.960784 .960784 .862745 rg
-n 192 24.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 36 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 12 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 66 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 102 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 108 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 144 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 36 12 re f*
-.960784 .960784 .862745 rg
-n 192 .75 6 12 re f*
-BT 1 0 0 1 0 86 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj .666667 .133333 1 rg (@trace) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (print) Tj /F4 10 Tf 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg T* .4 .4 .4 rg (...) Tj 0 0 0 rg T* 0 0 0 rg (Traceback) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (\() Tj 0 0 0 rg (most) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (recent) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (call) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (last) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj .4 .4 .4 rg (...) Tj 0 0 0 rg T* /F3 10 Tf .823529 .254902 .227451 rg (NameError) Tj /F4 10 Tf 0 0 0 rg (:) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (is) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (overridden) Tj 0 0 0 rg ( ) Tj /F3 10 Tf .666667 .133333 1 rg (in) Tj /F4 10 Tf 0 0 0 rg T* /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\):) Tj 0 0 0 rg T* ( ) Tj /F3 10 Tf 0 .501961 0 rg (return) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 0 rg (_call_) Tj 0 0 0 rg (\() Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (,) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (_func_) Tj 0 0 0 rg (\)) Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 125.4236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Finally, the implementation is such that the decorated function shares the original function dictionary:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 80.22362 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 36 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 48 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 54 12.75 18 12 re f*
-.960784 .960784 .862745 rg
-n 78 12.75 24 12 re f*
-.960784 .960784 .862745 rg
-n 108 12.75 138 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 .75 30 12 re f*
-.960784 .960784 .862745 rg
-n 72 .75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 .75 66 12 re f*
-.960784 .960784 .862745 rg
-n 156 .75 132 12 re f*
-BT 1 0 0 1 0 14 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (def) Tj /F4 10 Tf 0 0 0 rg ( ) Tj 0 0 1 rg (f) Tj 0 0 0 rg (\(\):) Tj 0 0 0 rg ( ) Tj /F3 10 Tf 0 .501961 0 rg (pass) Tj /F4 10 Tf 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original function) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting an attribute) Tj /F4 10 Tf 0 0 0 rg T* ET
-Q
-Q
-Q
-Q
-Q
-
-endstream
-endobj
-107 0 obj
-<< /Length 9888 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 643.8236 cm
-q
-q
-1 0 0 1 0 0 cm
-q
-1 0 0 1 6.6 6.6 cm
-q
-.662745 .662745 .662745 RG
-.5 w
-.960784 .960784 .862745 rg
-n -6 -6 468.6898 120 re B*
-Q
-q
-.960784 .960784 .862745 rg
-n 0 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 96.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 72 96.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 84 96.75 96 12 re f*
-.960784 .960784 .862745 rg
-n 186 96.75 162 12 re f*
-.960784 .960784 .862745 rg
-n 0 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 72.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 78 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 90 72.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 120 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 132 72.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 144 72.75 144 12 re f*
-.960784 .960784 .862745 rg
-n 0 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 48.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 48.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 48.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 0 36.75 66 12 re f*
-.960784 .960784 .862745 rg
-n 0 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 24.75 48 12 re f*
-.960784 .960784 .862745 rg
-n 72 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 78 24.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 114 24.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 126 24.75 126 12 re f*
-.960784 .960784 .862745 rg
-n 258 24.75 84 12 re f*
-.960784 .960784 .862745 rg
-n 0 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 6 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 12 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 24 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 30 12.75 6 12 re f*
-.960784 .960784 .862745 rg
-n 36 12.75 30 12 re f*
-.960784 .960784 .862745 rg
-n 72 12.75 234 12 re f*
-.960784 .960784 .862745 rg
-n 0 .75 96 12 re f*
-BT 1 0 0 1 0 98 Tm 12 TL /F4 10 Tf .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something else") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting another attribute) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (trace) Tj 0 0 0 rg (\() Tj 0 0 0 rg (f) Tj 0 0 0 rg (\)) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the decorated function) Tj /F4 10 Tf 0 0 0 rg T* T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr1) Tj 0 0 0 rg T* .729412 .129412 .129412 rg ('something') Tj 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (traced_f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj .4 .4 .4 rg (=) Tj 0 0 0 rg ( ) Tj .729412 .129412 .129412 rg ("something different") Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# setting attr) Tj /F4 10 Tf 0 0 0 rg T* .4 .4 .4 rg (>) Tj (>) Tj (>) Tj 0 0 0 rg ( ) Tj 0 0 0 rg (f) Tj .4 .4 .4 rg (.) Tj 0 0 0 rg (attr2) Tj 0 0 0 rg ( ) Tj /F6 10 Tf .25098 .501961 .501961 rg (# the original attribute did not change) Tj /F4 10 Tf 0 0 0 rg T* .729412 .129412 .129412 rg ('something else') Tj T* ET
-Q
-Q
-Q
-Q
-Q
-q
-1 0 0 1 62.69291 610.8236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (Compatibility notes) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 544.8236 cm
-q
-BT 1 0 0 1 0 50 Tm 1.864987 Tw 12 TL /F1 10 Tf 0 0 0 rg (Version 3.4 fixes some bugs in the support of recent versions of Python 3. Version 3.3 was the first) Tj T* 0 Tw .770697 Tw (version of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module to fully support Python 3, including ) Tj 0 0 .501961 rg (function annotations) Tj 0 0 0 rg (. Version 3.2) Tj T* 0 Tw .452093 Tw (was the first version to support Python 3 via the ) Tj /F4 10 Tf 0 0 0 rg (2to3 ) Tj /F1 10 Tf 0 0 0 rg (conversion tool. The hard work \(for me\) has been) Tj T* 0 Tw 2.514983 Tw (converting the documentation and the doctests. This has been possible only after that ) Tj 0 0 .501961 rg (docutils ) Tj 0 0 0 rg (and) Tj T* 0 Tw 0 0 .501961 rg (pygments ) Tj 0 0 0 rg (have been ported to Python 3.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 466.8236 cm
-q
-BT 1 0 0 1 0 62 Tm .793984 Tw 12 TL /F1 10 Tf 0 0 0 rg (Version 3 of the ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (module do not contain any backward incompatible change, apart from the) Tj T* 0 Tw 3.63498 Tw (removal of the functions ) Tj /F4 10 Tf 0 0 0 rg (get_info ) Tj /F1 10 Tf 0 0 0 rg (and ) Tj /F4 10 Tf 0 0 0 rg (new_wrapper) Tj /F1 10 Tf 0 0 0 rg (, which have been deprecated for years.) Tj T* 0 Tw .293672 Tw /F4 10 Tf 0 0 0 rg (get_info ) Tj /F1 10 Tf 0 0 0 rg (has been removed since it was little used and since it had to be changed anyway to work with) Tj T* 0 Tw 2.298555 Tw (Python 3.0; ) Tj /F4 10 Tf 0 0 0 rg (new_wrapper ) Tj /F1 10 Tf 0 0 0 rg (has been removed since it was useless: its major use case \(converting) Tj T* 0 Tw 7.136976 Tw (signature changing decorators to signature preserving decorators\) has been subsumed by) Tj T* 0 Tw /F4 10 Tf 0 0 0 rg (decorator_apply) Tj /F1 10 Tf 0 0 0 rg (, whereas the other use case can be managed with the ) Tj /F4 10 Tf 0 0 0 rg (FunctionMaker) Tj /F1 10 Tf 0 0 0 rg (.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 424.8236 cm
-q
-BT 1 0 0 1 0 26 Tm 1.329213 Tw 12 TL /F1 10 Tf 0 0 0 rg (There are a few changes in the documentation: I removed the ) Tj /F4 10 Tf 0 0 0 rg (decorator_factory ) Tj /F1 10 Tf 0 0 0 rg (example, which) Tj T* 0 Tw 2.562927 Tw (was confusing some of my users, and I removed the part about exotic signatures in the Python 3) Tj T* 0 Tw (documentation, since Python 3 does not support them.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 358.8236 cm
-q
-BT 1 0 0 1 0 50 Tm .942651 Tw 12 TL /F1 10 Tf 0 0 0 rg (Finally ) Tj /F4 10 Tf 0 0 0 rg (decorator ) Tj /F1 10 Tf 0 0 0 rg (cannot be used as a class decorator and the ) Tj 0 0 .501961 rg (functionality introduced in version 2.3) Tj T* 0 Tw .241163 Tw 0 0 0 rg (has been removed. That means that in order to define decorator factories with classes you need to define) Tj T* 0 Tw 1.122126 Tw (the ) Tj /F4 10 Tf 0 0 0 rg (__call__ ) Tj /F1 10 Tf 0 0 0 rg (method explicitly \(no magic anymore\). All these changes should not cause any trouble,) Tj T* 0 Tw .601163 Tw (since they were all rarely used features. Should you have any trouble, you can always downgrade to the) Tj T* 0 Tw (2.3 version.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 292.8236 cm
-q
-BT 1 0 0 1 0 50 Tm .196098 Tw 12 TL /F1 10 Tf 0 0 0 rg (The examples shown here have been tested with Python 2.6. Python 2.4 is also supported - of course the) Tj T* 0 Tw 1.649398 Tw (examples requiring the ) Tj /F4 10 Tf 0 0 0 rg (with ) Tj /F1 10 Tf 0 0 0 rg (statement will not work there. Python 2.5 works fine, but if you run the) Tj T* 0 Tw 1.41784 Tw (examples in the interactive interpreter you will notice a few differences since ) Tj /F4 10 Tf 0 0 0 rg (getargspec ) Tj /F1 10 Tf 0 0 0 rg (returns an) Tj T* 0 Tw .909982 Tw /F4 10 Tf 0 0 0 rg (ArgSpec ) Tj /F1 10 Tf 0 0 0 rg (namedtuple instead of a regular tuple. That means that running the file ) Tj /F4 10 Tf 0 0 0 rg (documentation.py) Tj T* 0 Tw /F1 10 Tf 0 0 0 rg (under Python 2.5 will print a few errors, but they are not serious.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 259.8236 cm
-q
-BT 1 0 0 1 0 3.5 Tm 21 TL /F2 17.5 Tf 0 0 0 rg (LICENCE) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 241.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Copyright \(c\) 2005-2015, Michele Simionato All rights reserved.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 211.8236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.328555 Tw (Redistribution and use in source and binary forms, with or without modification, are permitted provided) Tj T* 0 Tw (that the following conditions are met:) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 205.8236 cm
-Q
-q
-1 0 0 1 62.69291 157.8236 cm
-0 0 0 rg
-BT /F1 10 Tf 12 TL ET
-BT 1 0 0 1 0 2 Tm T* ET
-q
-1 0 0 1 20 0 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL .830651 Tw (Redistributions of source code must retain the above copyright notice, this list of conditions and the) Tj T* 0 Tw .161647 Tw (following disclaimer. Redistributions in bytecode form must reproduce the above copyright notice, this) Tj T* 0 Tw 1.259213 Tw (list of conditions and the following disclaimer in the documentation and/or other materials provided) Tj T* 0 Tw (with the distribution.) Tj T* ET
-Q
-Q
-q
-Q
-Q
-q
-1 0 0 1 62.69291 157.8236 cm
-Q
-q
-1 0 0 1 62.69291 79.82362 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 62 Tm /F1 10 Tf 12 TL .17998 Tw (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND) Tj T* 0 Tw 2.911797 Tw (ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED) Tj T* 0 Tw 5.165529 Tw (WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE) Tj T* 0 Tw 1.395433 Tw (DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE) Tj T* 0 Tw 5.53122 Tw (FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL) Tj T* 0 Tw 2.705976 Tw (DAMAGES \(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR) Tj T* 0 Tw ET
-Q
-Q
-
-endstream
-endobj
-108 0 obj
-<< /Length 838 >>
-stream
-1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
-q
-1 0 0 1 62.69291 717.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 38 Tm /F1 10 Tf 12 TL 3.868976 Tw (SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION\) HOWEVER) Tj T* 0 Tw 1.326647 Tw (CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR) Tj T* 0 Tw 1.525366 Tw (TORT \(INCLUDING NEGLIGENCE OR OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE OF) Tj T* 0 Tw (THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.) Tj T* ET
-Q
-Q
-q
-1 0 0 1 62.69291 687.0236 cm
-q
-0 0 0 rg
-BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL .407132 Tw (If you use this software and you are happy with it, consider sending me a note, just to gratify my ego. On) Tj T* 0 Tw (the other hand, if you use this software and you are unhappy with it, send me a patch!) Tj T* ET
-Q
-Q
-
-endstream
-endobj
-109 0 obj
-<< /Nums [ 0 110 0 R 1 111 0 R 2 112 0 R 3 113 0 R 4 114 0 R
- 5 115 0 R 6 116 0 R 7 117 0 R 8 118 0 R 9 119 0 R
- 10 120 0 R 11 121 0 R 12 122 0 R 13 123 0 R 14 124 0 R
- 15 125 0 R ] >>
-endobj
-110 0 obj
-<< /S /D /St 1 >>
-endobj
-111 0 obj
-<< /S /D /St 2 >>
-endobj
-112 0 obj
-<< /S /D /St 3 >>
-endobj
-113 0 obj
-<< /S /D /St 4 >>
-endobj
-114 0 obj
-<< /S /D /St 5 >>
-endobj
-115 0 obj
-<< /S /D /St 6 >>
-endobj
-116 0 obj
-<< /S /D /St 7 >>
-endobj
-117 0 obj
-<< /S /D /St 8 >>
-endobj
-118 0 obj
-<< /S /D /St 9 >>
-endobj
-119 0 obj
-<< /S /D /St 10 >>
-endobj
-120 0 obj
-<< /S /D /St 11 >>
-endobj
-121 0 obj
-<< /S /D /St 12 >>
-endobj
-122 0 obj
-<< /S /D /St 13 >>
-endobj
-123 0 obj
-<< /S /D /St 14 >>
-endobj
-124 0 obj
-<< /S /D /St 15 >>
-endobj
-125 0 obj
-<< /S /D /St 16 >>
-endobj
-xref
-0 126
-0000000000 65535 f
-0000000075 00000 n
-0000000161 00000 n
-0000000271 00000 n
-0000000386 00000 n
-0000000499 00000 n
-0000000688 00000 n
-0000000886 00000 n
-0000000994 00000 n
-0000001165 00000 n
-0000001336 00000 n
-0000001508 00000 n
-0000001680 00000 n
-0000001852 00000 n
-0000002024 00000 n
-0000002196 00000 n
-0000002368 00000 n
-0000002540 00000 n
-0000002712 00000 n
-0000002884 00000 n
-0000003056 00000 n
-0000003228 00000 n
-0000003400 00000 n
-0000003572 00000 n
-0000003744 00000 n
-0000003916 00000 n
-0000004088 00000 n
-0000004260 00000 n
-0000004432 00000 n
-0000004604 00000 n
-0000004776 00000 n
-0000004948 00000 n
-0000005120 00000 n
-0000005292 00000 n
-0000005464 00000 n
-0000005636 00000 n
-0000005808 00000 n
-0000005980 00000 n
-0000006152 00000 n
-0000006324 00000 n
-0000006496 00000 n
-0000006668 00000 n
-0000006840 00000 n
-0000007012 00000 n
-0000007184 00000 n
-0000007356 00000 n
-0000007859 00000 n
-0000007978 00000 n
-0000008183 00000 n
-0000008300 00000 n
-0000008529 00000 n
-0000008756 00000 n
-0000008985 00000 n
-0000009195 00000 n
-0000009391 00000 n
-0000009620 00000 n
-0000009830 00000 n
-0000010040 00000 n
-0000010251 00000 n
-0000010462 00000 n
-0000010673 00000 n
-0000010864 00000 n
-0000011094 00000 n
-0000011312 00000 n
-0000011542 00000 n
-0000011753 00000 n
-0000011948 00000 n
-0000012178 00000 n
-0000012374 00000 n
-0000012562 00000 n
-0000012738 00000 n
-0000012995 00000 n
-0000013246 00000 n
-0000013457 00000 n
-0000013567 00000 n
-0000013815 00000 n
-0000013893 00000 n
-0000014010 00000 n
-0000014139 00000 n
-0000014281 00000 n
-0000014411 00000 n
-0000014546 00000 n
-0000014684 00000 n
-0000014826 00000 n
-0000014952 00000 n
-0000015075 00000 n
-0000015207 00000 n
-0000015348 00000 n
-0000015489 00000 n
-0000015642 00000 n
-0000015783 00000 n
-0000015920 00000 n
-0000016032 00000 n
-0000016206 00000 n
-0000025233 00000 n
-0000037517 00000 n
-0000053936 00000 n
-0000072471 00000 n
-0000093910 00000 n
-0000113111 00000 n
-0000127049 00000 n
-0000146974 00000 n
-0000163187 00000 n
-0000177912 00000 n
-0000192010 00000 n
-0000208189 00000 n
-0000216529 00000 n
-0000232666 00000 n
-0000242612 00000 n
-0000243507 00000 n
-0000243721 00000 n
-0000243759 00000 n
-0000243797 00000 n
-0000243835 00000 n
-0000243873 00000 n
-0000243911 00000 n
-0000243949 00000 n
-0000243987 00000 n
-0000244025 00000 n
-0000244063 00000 n
-0000244102 00000 n
-0000244141 00000 n
-0000244180 00000 n
-0000244219 00000 n
-0000244258 00000 n
-0000244297 00000 n
-trailer
-<< /ID
- % ReportLab generated PDF document -- digest (http://www.reportlab.com)
- [(\332:\210,\011\256\334I\352\235\026\321\241\263\032\277) (\332:\210,\011\256\334I\352\235\026\321\241\263\032\277)]
- /Info 74 0 R /Root 73 0 R /Size 126 >>
-startxref
-244336
-%%EOF
diff --git a/documentation3.py b/documentation3.py
deleted file mode 100644
index dea3821..0000000
--- a/documentation3.py
+++ /dev/null
@@ -1,1208 +0,0 @@
-r"""
-The ``decorator`` module
-=============================================================
-
-:Author: Michele Simionato
-:E-mail: michele.simionato@gmail.com
-:Version: $VERSION ($DATE)
-:Requires: Python 2.4+
-:Download page: http://pypi.python.org/pypi/decorator/$VERSION
-:Installation: ``easy_install decorator``
-:License: BSD license
-
-.. contents::
-
-Introduction
-------------------------------------------------
-
-Python decorators are an interesting example of why syntactic sugar
-matters. In principle, their introduction in Python 2.4 changed
-nothing, since they do not provide any new functionality which was not
-already present in the language. In practice, their introduction has
-significantly changed the way we structure our programs in Python. I
-believe the change is for the best, and that decorators are a great
-idea since:
-
-* decorators help reducing boilerplate code;
-* decorators help separation of concerns;
-* decorators enhance readability and maintenability;
-* decorators are explicit.
-
-Still, as of now, writing custom decorators correctly requires
-some experience and it is not as easy as it could be. For instance,
-typical implementations of decorators involve nested functions, and
-we all know that flat is better than nested.
-
-The aim of the ``decorator`` module it to simplify the usage of
-decorators for the average programmer, and to popularize decorators by
-showing various non-trivial examples. Of course, as all techniques,
-decorators can be abused (I have seen that) and you should not try to
-solve every problem with a decorator, just because you can.
-
-You may find the source code for all the examples
-discussed here in the ``documentation.py`` file, which contains
-this documentation in the form of doctests.
-
-Definitions
-------------------------------------
-
-Technically speaking, any Python object which can be called with one argument
-can be used as a decorator. However, this definition is somewhat too large
-to be really useful. It is more convenient to split the generic class of
-decorators in two subclasses:
-
-+ *signature-preserving* decorators, i.e. callable objects taking a
- function as input and returning a function *with the same
- signature* as output;
-
-+ *signature-changing* decorators, i.e. decorators that change
- the signature of their input function, or decorators returning
- non-callable objects.
-
-Signature-changing decorators have their use: for instance the
-builtin classes ``staticmethod`` and ``classmethod`` are in this
-group, since they take functions and return descriptor objects which
-are not functions, nor callables.
-
-However, signature-preserving decorators are more common and easier to
-reason about; in particular signature-preserving decorators can be
-composed together whereas other decorators in general cannot.
-
-Writing signature-preserving decorators from scratch is not that
-obvious, especially if one wants to define proper decorators that
-can accept functions with any signature. A simple example will clarify
-the issue.
-
-Statement of the problem
-------------------------------
-
-A very common use case for decorators is the memoization of functions.
-A ``memoize`` decorator works by caching
-the result of the function call in a dictionary, so that the next time
-the function is called with the same input parameters the result is retrieved
-from the cache and not recomputed. There are many implementations of
-``memoize`` in http://www.python.org/moin/PythonDecoratorLibrary,
-but they do not preserve the signature.
-A simple implementation could be the following (notice
-that in general it is impossible to memoize correctly something
-that depends on non-hashable arguments):
-
-$$memoize_uw
-
-Here we used the functools.update_wrapper_ utility, which has
-been added in Python 2.5 expressly to simplify the definition of decorators
-(in older versions of Python you need to copy the function attributes
-``__name__``, ``__doc__``, ``__module__`` and ``__dict__``
-from the original function to the decorated function by hand).
-
-.. _functools.update_wrapper: https://docs.python.org/3/library/functools.html#functools.update_wrapper
-
-The implementation above works in the sense that the decorator
-can accept functions with generic signatures; unfortunately this
-implementation does *not* define a signature-preserving decorator, since in
-general ``memoize_uw`` returns a function with a
-*different signature* from the original function.
-
-Consider for instance the following case:
-
-.. code-block:: python
-
- >>> @memoize_uw
- ... def f1(x):
- ... time.sleep(1) # simulate some long computation
- ... return x
-
-Here the original function takes a single argument named ``x``,
-but the decorated function takes any number of arguments and
-keyword arguments:
-
-.. code-block:: python
-
- >>> from inspect import getargspec
- >>> print(getargspec(f1))
- ArgSpec(args=[], varargs='args', keywords='kw', defaults=None)
-
-This means that introspection tools such as pydoc will give
-wrong informations about the signature of ``f1``. This is pretty bad:
-pydoc will tell you that the function accepts a generic signature
-``*args``, ``**kw``, but when you try to call the function with more than an
-argument, you will get an error:
-
-.. code-block:: python
-
- >>> f1(0, 1) # doctest: +IGNORE_EXCEPTION_DETAIL
- Traceback (most recent call last):
- ...
- TypeError: f1() takes exactly 1 positional argument (2 given)
-
-The solution
------------------------------------------
-
-The solution is to provide a generic factory of generators, which
-hides the complexity of making signature-preserving decorators
-from the application programmer. The ``decorator`` function in
-the ``decorator`` module is such a factory:
-
-.. code-block:: python
-
- >>> from decorator import decorator
-
-``decorator`` takes two arguments, a caller function describing the
-functionality of the decorator and a function to be decorated; it
-returns the decorated function. The caller function must have
-signature ``(f, *args, **kw)`` and it must call the original function ``f``
-with arguments ``args`` and ``kw``, implementing the wanted capability,
-i.e. memoization in this case:
-
-$$_memoize
-
-At this point you can define your decorator as follows:
-
-$$memoize
-
-The difference with respect to the ``memoize_uw`` approach, which is based
-on nested functions, is that the decorator module forces you to lift
-the inner function at the outer level (*flat is better than nested*).
-Moreover, you are forced to pass explicitly the function you want to
-decorate to the caller function.
-
-Here is a test of usage:
-
-.. code-block:: python
-
- >>> @memoize
- ... def heavy_computation():
- ... time.sleep(2)
- ... return "done"
-
- >>> print(heavy_computation()) # the first time it will take 2 seconds
- done
-
- >>> print(heavy_computation()) # the second time it will be instantaneous
- done
-
-The signature of ``heavy_computation`` is the one you would expect:
-
-.. code-block:: python
-
- >>> print(getargspec(heavy_computation))
- ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
-
-A ``trace`` decorator
-------------------------------------------------------
-
-As an additional example, here is how you can define a trivial
-``trace`` decorator, which prints a message everytime the traced
-function is called:
-
-$$_trace
-
-$$trace
-
-Here is an example of usage:
-
-.. code-block:: python
-
- >>> @trace
- ... def f1(x):
- ... pass
-
-It is immediate to verify that ``f1`` works
-
-.. code-block:: python
-
- >>> f1(0)
- calling f1 with args (0,), {}
-
-and it that it has the correct signature:
-
-.. code-block:: python
-
- >>> print(getargspec(f1))
- ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
-
-The same decorator works with functions of any signature:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(x, y=1, z=2, *args, **kw):
- ... pass
-
- >>> f(0, 3)
- calling f with args (0, 3, 2), {}
-
- >>> print(getargspec(f))
- ArgSpec(args=['x', 'y', 'z'], varargs='args', keywords='kw', defaults=(1, 2))
-
-Function annotations
----------------------------------------------
-
-Python 3 introduced the concept of `function annotations`_,i.e. the ability
-to annotate the signature of a function with additional information,
-stored in a dictionary named ``__annotations__``. The decorator module,
-starting from release 3.3, is able to understand and to preserve the
-annotations. Here is an example:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(x: 'the first argument', y: 'default argument'=1, z=2,
- ... *args: 'varargs', **kw: 'kwargs'):
- ... pass
-
-In order to introspect functions with annotations, one needs the
-utility ``inspect.getfullargspec``, new in Python 3:
-
-.. code-block:: python
-
- >>> from inspect import getfullargspec
- >>> argspec = getfullargspec(f)
- >>> argspec.args
- ['x', 'y', 'z']
- >>> argspec.varargs
- 'args'
- >>> argspec.varkw
- 'kw'
- >>> argspec.defaults
- (1, 2)
- >>> argspec.kwonlyargs
- []
- >>> argspec.kwonlydefaults
-
-You can also check that the ``__annotations__`` dictionary is preserved:
-
-.. code-block:: python
-
- >>> f.__annotations__ == f.__wrapped__.__annotations__
- True
-
-Depending on the version of the decorator module, the two dictionaries can
-be the same object or not: you cannot rely on object identity, but you can
-rely on the content being the same.
-
-``decorator`` is a decorator
----------------------------------------------
-
-It may be annoying to write a caller function (like the ``_trace``
-function above) and then a trivial wrapper
-(``def trace(f): return decorator(_trace, f)``) every time. For this reason,
-the ``decorator`` module provides an easy shortcut to convert
-the caller function into a signature-preserving decorator:
-you can just call ``decorator`` with a single argument.
-In our example you can just write ``trace = decorator(_trace)``.
-The ``decorator`` function can also be used as a signature-changing
-decorator, just as ``classmethod`` and ``staticmethod``.
-However, ``classmethod`` and ``staticmethod`` return generic
-objects which are not callable, while ``decorator`` returns
-signature-preserving decorators, i.e. functions of a single argument.
-For instance, you can write directly
-
-.. code-block:: python
-
- >>> @decorator
- ... def trace(f, *args, **kw):
- ... kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
- ... print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
- ... return f(*args, **kw)
-
-and now ``trace`` will be a decorator. Actually ``trace`` is a ``partial``
-object which can be used as a decorator:
-
-.. code-block:: python
-
- >>> trace # doctest: +ELLIPSIS
- <function trace at 0x...>
-
-Here is an example of usage:
-
-.. code-block:: python
-
- >>> @trace
- ... def func(): pass
-
- >>> func()
- calling func with args (), {}
-
-If you are using an old Python version (Python 2.4) the
-``decorator`` module provides a poor man replacement for
-``functools.partial``.
-
-``blocking``
--------------------------------------------
-
-Sometimes one has to deal with blocking resources, such as ``stdin``, and
-sometimes it is best to have back a "busy" message than to block everything.
-This behavior can be implemented with a suitable family of decorators,
-where the parameter is the busy message:
-
-$$blocking
-
-Functions decorated with ``blocking`` will return a busy message if
-the resource is unavailable, and the intended result if the resource is
-available. For instance:
-
-.. code-block:: python
-
- >>> @blocking("Please wait ...")
- ... def read_data():
- ... time.sleep(3) # simulate a blocking resource
- ... return "some data"
-
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1)
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1)
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1.1) # after 3.1 seconds, data is available
- >>> print(read_data())
- some data
-
-``async``
---------------------------------------------
-
-We have just seen an examples of a simple decorator factory,
-implemented as a function returning a decorator.
-For more complex situations, it is more
-convenient to implement decorator factories as classes returning
-callable objects that can be converted into decorators.
-
-As an example, here will I show a decorator
-which is able to convert a blocking function into an asynchronous
-function. The function, when called,
-is executed in a separate thread. Moreover, it is possible to set
-three callbacks ``on_success``, ``on_failure`` and ``on_closing``,
-to specify how to manage the function call (of course the code here
-is just an example, it is not a recommended way of doing multi-threaded
-programming). The implementation is the following:
-
-$$on_success
-$$on_failure
-$$on_closing
-$$Async
-
-The decorated function returns
-the current execution thread, which can be stored and checked later, for
-instance to verify that the thread ``.isAlive()``.
-
-Here is an example of usage. Suppose one wants to write some data to
-an external resource which can be accessed by a single user at once
-(for instance a printer). Then the access to the writing function must
-be locked. Here is a minimalistic example:
-
-.. code-block:: python
-
- >>> async = decorator(Async(threading.Thread))
-
- >>> datalist = [] # for simplicity the written data are stored into a list.
-
- >>> @async
- ... def write(data):
- ... # append data to the datalist by locking
- ... with threading.Lock():
- ... time.sleep(1) # emulate some long running operation
- ... datalist.append(data)
- ... # other operations not requiring a lock here
-
-Each call to ``write`` will create a new writer thread, but there will
-be no synchronization problems since ``write`` is locked.
-
-.. code-block:: python
-
- >>> write("data1") # doctest: +ELLIPSIS
- <Thread(write-1, started...)>
-
- >>> time.sleep(.1) # wait a bit, so we are sure data2 is written after data1
-
- >>> write("data2") # doctest: +ELLIPSIS
- <Thread(write-2, started...)>
-
- >>> time.sleep(2) # wait for the writers to complete
-
- >>> print(datalist)
- ['data1', 'data2']
-
-contextmanager
--------------------------------------
-
-For a long time Python had in its standard library a ``contextmanager``
-decorator, able to convert generator functions into
-``_GeneratorContextManager`` factories. For instance if you write
-
-.. code-block:: python
-
- >>> from contextlib import contextmanager
- >>> @contextmanager
- ... def before_after(before, after):
- ... print(before)
- ... yield
- ... print(after)
-
-
-then ``before_after`` is a factory function returning
-``_GeneratorContextManager`` objects which can be used with
-the ``with`` statement:
-
-.. code-block:: python
-
- >>> ba = before_after('BEFORE', 'AFTER')
- >>> type(ba)
- <class 'contextlib._GeneratorContextManager'>
- >>> with ba:
- ... print('hello')
- BEFORE
- hello
- AFTER
-
-Basically, it is as if the content of the ``with`` block was executed
-in the place of the ``yield`` expression in the generator function.
-In Python 3.2 ``_GeneratorContextManager``
-objects were enhanced with a ``__call__``
-method, so that they can be used as decorators as in this example:
-
-.. code-block:: python
-
- >>> @ba # doctest: +SKIP
- ... def hello():
- ... print('hello')
- ...
- >>> hello() # doctest: +SKIP
- BEFORE
- hello
- AFTER
-
-The ``ba`` decorator is basically inserting a ``with ba:``
-block inside the function.
-However there two issues: the first is that ``_GeneratorContextManager``
-objects are callable only in Python 3.2, so the previous example will break
-in older versions of Python; the second is that
-``_GeneratorContextManager`` objects do not preserve the signature
-of the decorated functions: the decorated ``hello`` function here will have
-a generic signature ``hello(*args, **kwargs)`` but will break when
-called with more than zero arguments. For such reasons the decorator
-module, starting with release 3.4, offers a ``decorator.contextmanager``
-decorator that solves both problems and works even in Python 2.5.
-The usage is the same and factories decorated with ``decorator.contextmanager``
-will returns instances of ``ContextManager``, a subclass of
-``contextlib._GeneratorContextManager`` with a ``__call__`` method
-acting as a signature-preserving decorator.
-
-The ``FunctionMaker`` class
----------------------------------------------------------------
-
-You may wonder about how the functionality of the ``decorator`` module
-is implemented. The basic building block is
-a ``FunctionMaker`` class which is able to generate on the fly
-functions with a given name and signature from a function template
-passed as a string. Generally speaking, you should not need to
-resort to ``FunctionMaker`` when writing ordinary decorators, but
-it is handy in some circumstances. You will see an example shortly, in
-the implementation of a cool decorator utility (``decorator_apply``).
-
-``FunctionMaker`` provides a ``.create`` classmethod which
-takes as input the name, signature, and body of the function
-we want to generate as well as the execution environment
-were the function is generated by ``exec``. Here is an example:
-
-.. code-block:: python
-
- >>> def f(*args, **kw): # a function with a generic signature
- ... print(args, kw)
-
- >>> f1 = FunctionMaker.create('f1(a, b)', 'f(a, b)', dict(f=f))
- >>> f1(1,2)
- (1, 2) {}
-
-It is important to notice that the function body is interpolated
-before being executed, so be careful with the ``%`` sign!
-
-``FunctionMaker.create`` also accepts keyword arguments and such
-arguments are attached to the resulting function. This is useful
-if you want to set some function attributes, for instance the
-docstring ``__doc__``.
-
-For debugging/introspection purposes it may be useful to see
-the source code of the generated function; to do that, just
-pass the flag ``addsource=True`` and a ``__source__`` attribute will
-be added to the generated function:
-
-.. code-block:: python
-
- >>> f1 = FunctionMaker.create(
- ... 'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True)
- >>> print(f1.__source__)
- def f1(a, b):
- f(a, b)
- <BLANKLINE>
-
-``FunctionMaker.create`` can take as first argument a string,
-as in the examples before, or a function. This is the most common
-usage, since typically you want to decorate a pre-existing
-function. A framework author may want to use directly ``FunctionMaker.create``
-instead of ``decorator``, since it gives you direct access to the body
-of the generated function. For instance, suppose you want to instrument
-the ``__init__`` methods of a set of classes, by preserving their
-signature (such use case is not made up; this is done in SQAlchemy
-and in other frameworks). When the first argument of ``FunctionMaker.create``
-is a function, a ``FunctionMaker`` object is instantiated internally,
-with attributes ``args``, ``varargs``,
-``keywords`` and ``defaults`` which are the
-the return values of the standard library function ``inspect.getargspec``.
-For each argument in the ``args`` (which is a list of strings containing
-the names of the mandatory arguments) an attribute ``arg0``, ``arg1``,
-..., ``argN`` is also generated. Finally, there is a ``signature``
-attribute, a string with the signature of the original function.
-
-Notice that while I do not have plans
-to change or remove the functionality provided in the
-``FunctionMaker`` class, I do not guarantee that it will stay
-unchanged forever. For instance, right now I am using the traditional
-string interpolation syntax for function templates, but Python 2.6
-and Python 3.0 provide a newer interpolation syntax and I may use
-the new syntax in the future.
-On the other hand, the functionality provided by
-``decorator`` has been there from version 0.1 and it is guaranteed to
-stay there forever.
-
-Getting the source code
----------------------------------------------------
-
-Internally ``FunctionMaker.create`` uses ``exec`` to generate the
-decorated function. Therefore
-``inspect.getsource`` will not work for decorated functions. That
-means that the usual '??' trick in IPython will give you the (right on
-the spot) message ``Dynamically generated function. No source code
-available``. In the past I have considered this acceptable, since
-``inspect.getsource`` does not really work even with regular
-decorators. In that case ``inspect.getsource`` gives you the wrapper
-source code which is probably not what you want:
-
-$$identity_dec
-
-.. code-block:: python
-
- @identity_dec
- def example(): pass
-
- >>> print(inspect.getsource(example))
- def wrapper(*args, **kw):
- return func(*args, **kw)
- <BLANKLINE>
-
-(see bug report 1764286_ for an explanation of what is happening).
-Unfortunately the bug is still there, even in Python 2.7 and 3.1.
-There is however a workaround. The decorator module adds an
-attribute ``.__wrapped__`` to the decorated function, containing
-a reference to the original function. The easy way to get
-the source code is to call ``inspect.getsource`` on the
-undecorated function:
-
-.. code-block:: python
-
- >>> print(inspect.getsource(factorial.__wrapped__))
- @tail_recursive
- def factorial(n, acc=1):
- "The good old factorial"
- if n == 0:
- return acc
- return factorial(n-1, n*acc)
- <BLANKLINE>
-
-.. _1764286: http://bugs.python.org/issue1764286
-
-Dealing with third party decorators
------------------------------------------------------------------
-
-Sometimes you find on the net some cool decorator that you would
-like to include in your code. However, more often than not the cool
-decorator is not signature-preserving. Therefore you may want an easy way to
-upgrade third party decorators to signature-preserving decorators without
-having to rewrite them in terms of ``decorator``. You can use a
-``FunctionMaker`` to implement that functionality as follows:
-
-$$decorator_apply
-
-``decorator_apply`` sets the attribute ``.__wrapped__`` of the generated
-function to the original function, so that you can get the right
-source code.
-
-Notice that I am not providing this functionality in the ``decorator``
-module directly since I think it is best to rewrite the decorator rather
-than adding an additional level of indirection. However, practicality
-beats purity, so you can add ``decorator_apply`` to your toolbox and
-use it if you need to.
-
-In order to give an example of usage of ``decorator_apply``, I will show a
-pretty slick decorator that converts a tail-recursive function in an iterative
-function. I have shamelessly stolen the basic idea from Kay Schluehr's recipe
-in the Python Cookbook,
-http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691.
-
-$$TailRecursive
-
-Here the decorator is implemented as a class returning callable
-objects.
-
-$$tail_recursive
-
-Here is how you apply the upgraded decorator to the good old factorial:
-
-$$factorial
-
-.. code-block:: python
-
- >>> print(factorial(4))
- 24
-
-This decorator is pretty impressive, and should give you some food for
-your mind ;) Notice that there is no recursion limit now, and you can
-easily compute ``factorial(1001)`` or larger without filling the stack
-frame. Notice also that the decorator will not work on functions which
-are not tail recursive, such as the following
-
-$$fact
-
-(reminder: a function is tail recursive if it either returns a value without
-making a recursive call, or returns directly the result of a recursive
-call).
-
-Caveats and limitations
--------------------------------------------
-
-The first thing you should be aware of, it the fact that decorators
-have a performance penalty.
-The worse case is shown by the following example::
-
- $ cat performance.sh
- python3 -m timeit -s "
- from decorator import decorator
-
- @decorator
- def do_nothing(func, *args, **kw):
- return func(*args, **kw)
-
- @do_nothing
- def f():
- pass
- " "f()"
-
- python3 -m timeit -s "
- def f():
- pass
- " "f()"
-
-On my MacBook, using the ``do_nothing`` decorator instead of the
-plain function is more than three times slower::
-
- $ bash performance.sh
- 1000000 loops, best of 3: 0.669 usec per loop
- 1000000 loops, best of 3: 0.181 usec per loop
-
-It should be noted that a real life function would probably do
-something more useful than ``f`` here, and therefore in real life the
-performance penalty could be completely negligible. As always, the
-only way to know if there is
-a penalty in your specific use case is to measure it.
-
-You should be aware that decorators will make your tracebacks
-longer and more difficult to understand. Consider this example:
-
-.. code-block:: python
-
- >>> @trace
- ... def f():
- ... 1/0
-
-Calling ``f()`` will give you a ``ZeroDivisionError``, but since the
-function is decorated the traceback will be longer:
-
-.. code-block:: python
-
- >>> f() # doctest: +ELLIPSIS
- Traceback (most recent call last):
- ...
- File "<string>", line 2, in f
- File "<doctest __main__[22]>", line 4, in trace
- return f(*args, **kw)
- File "<doctest __main__[51]>", line 3, in f
- 1/0
- ZeroDivisionError: ...
-
-You see here the inner call to the decorator ``trace``, which calls
-``f(*args, **kw)``, and a reference to ``File "<string>", line 2, in f``.
-This latter reference is due to the fact that internally the decorator
-module uses ``exec`` to generate the decorated function. Notice that
-``exec`` is *not* responsibile for the performance penalty, since is the
-called *only once* at function decoration time, and not every time
-the decorated function is called.
-
-At present, there is no clean way to avoid ``exec``. A clean solution
-would require to change the CPython implementation of functions and
-add an hook to make it possible to change their signature directly.
-That could happen in future versions of Python (see PEP 362_) and
-then the decorator module would become obsolete. However, at present,
-even in Python 3.2 it is impossible to change the function signature
-directly, therefore the ``decorator`` module is still useful.
-Actually, this is one of the main reasons why I keep maintaining
-the module and releasing new versions.
-
-.. _362: http://www.python.org/dev/peps/pep-0362
-
-In the present implementation, decorators generated by ``decorator``
-can only be used on user-defined Python functions or methods, not on generic
-callable objects, nor on built-in functions, due to limitations of the
-``inspect`` module in the standard library.
-
-There is a restriction on the names of the arguments: for instance,
-if try to call an argument ``_call_`` or ``_func_``
-you will get a ``NameError``:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(_func_): print(f)
- ...
- Traceback (most recent call last):
- ...
- NameError: _func_ is overridden in
- def f(_func_):
- return _call_(_func_, _func_)
-
-Finally, the implementation is such that the decorated function shares
-the original function dictionary:
-
-.. code-block:: python
-
- >>> def f(): pass # the original function
- >>> f.attr1 = "something" # setting an attribute
- >>> f.attr2 = "something else" # setting another attribute
-
- >>> traced_f = trace(f) # the decorated function
-
- >>> traced_f.attr1
- 'something'
- >>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did not change
- 'something else'
-
-Compatibility notes
----------------------------------------------------------------
-
-Version 3.4 fixes some bugs in the support of recent versions of
-Python 3. Version 3.3 was the first version of the ``decorator``
-module to fully support Python 3, including `function
-annotations`_. Version 3.2 was the first version to support Python 3
-via the ``2to3`` conversion tool. The hard work (for me) has been
-converting the documentation and the doctests. This has been possible
-only after that docutils_ and pygments_ have been ported to Python 3.
-
-Version 3 of the ``decorator`` module do not contain any backward
-incompatible change, apart from the removal of the functions
-``get_info`` and ``new_wrapper``, which have been deprecated for
-years. ``get_info`` has been removed since it was little used and
-since it had to be changed anyway to work with Python 3.0;
-``new_wrapper`` has been removed since it was useless: its major use
-case (converting signature changing decorators to signature preserving
-decorators) has been subsumed by ``decorator_apply``, whereas the other use
-case can be managed with the ``FunctionMaker``.
-
-There are a few changes in the documentation: I removed the
-``decorator_factory`` example, which was confusing some of my users,
-and I removed the part about exotic signatures in the Python 3
-documentation, since Python 3 does not support them.
-
-Finally ``decorator`` cannot be used as a class decorator and the
-`functionality introduced in version 2.3`_ has been removed. That
-means that in order to define decorator factories with classes you
-need to define the ``__call__`` method explicitly (no magic anymore).
-All these changes should not cause any trouble, since they were
-all rarely used features. Should you have any trouble, you can always
-downgrade to the 2.3 version.
-
-The examples shown here have been tested with Python 2.6. Python 2.4
-is also supported - of course the examples requiring the ``with``
-statement will not work there. Python 2.5 works fine, but if you
-run the examples in the interactive interpreter
-you will notice a few differences since
-``getargspec`` returns an ``ArgSpec`` namedtuple instead of a regular
-tuple. That means that running the file
-``documentation.py`` under Python 2.5 will print a few errors, but
-they are not serious.
-
-.. _functionality introduced in version 2.3: http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories
-.. _function annotations: http://www.python.org/dev/peps/pep-3107/
-.. _distribute: http://packages.python.org/distribute/
-.. _docutils: http://docutils.sourceforge.net/
-.. _pygments: http://pygments.org/
-
-LICENCE
----------------------------------------------
-
-Copyright (c) 2005-2015, Michele Simionato
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- Redistributions in bytecode form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-If you use this software and you are happy with it, consider sending me a
-note, just to gratify my ego. On the other hand, if you use this software and
-you are unhappy with it, send me a patch!
-"""
-from __future__ import with_statement
-import sys
-import threading
-import time
-import functools
-import inspect
-import itertools
-from decorator import *
-from functools import partial
-from setup import VERSION
-
-today = time.strftime('%Y-%m-%d')
-
-__doc__ = __doc__.replace('$VERSION', VERSION).replace('$DATE', today)
-
-
-def decorator_apply(dec, func):
- """
- Decorate a function by preserving the signature even if dec
- is not a signature-preserving decorator.
- """
- return FunctionMaker.create(
- func, 'return decorated(%(signature)s)',
- dict(decorated=dec(func)), __wrapped__=func)
-
-
-def _trace(f, *args, **kw):
- kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
- print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
- return f(*args, **kw)
-
-
-def trace(f):
- return decorator(_trace, f)
-
-
-def on_success(result): # default implementation
- "Called on the result of the function"
- return result
-
-
-def on_failure(exc_info): # default implementation
- "Called if the function fails"
- pass
-
-
-def on_closing(): # default implementation
- "Called at the end, both in case of success and failure"
- pass
-
-
-class Async(object):
- """
- A decorator converting blocking functions into asynchronous
- functions, by using threads or processes. Examples:
-
- async_with_threads = Async(threading.Thread)
- async_with_processes = Async(multiprocessing.Process)
- """
-
- def __init__(self, threadfactory, on_success=on_success,
- on_failure=on_failure, on_closing=on_closing):
- self.threadfactory = threadfactory
- self.on_success = on_success
- self.on_failure = on_failure
- self.on_closing = on_closing
-
- def __call__(self, func, *args, **kw):
- try:
- counter = func.counter
- except AttributeError: # instantiate the counter at the first call
- counter = func.counter = itertools.count(1)
- name = '%s-%s' % (func.__name__, next(counter))
-
- def func_wrapper():
- try:
- result = func(*args, **kw)
- except:
- self.on_failure(sys.exc_info())
- else:
- return self.on_success(result)
- finally:
- self.on_closing()
- thread = self.threadfactory(None, func_wrapper, name)
- thread.start()
- return thread
-
-
-def identity_dec(func):
- def wrapper(*args, **kw):
- return func(*args, **kw)
- return wrapper
-
-
-@identity_dec
-def example():
- pass
-
-
-def memoize_uw(func):
- func.cache = {}
-
- def memoize(*args, **kw):
- if kw: # frozenset is used to ensure hashability
- key = args, frozenset(kw.iteritems())
- else:
- key = args
- cache = func.cache
- if key in cache:
- return cache[key]
- else:
- cache[key] = result = func(*args, **kw)
- return result
- return functools.update_wrapper(memoize, func)
-
-
-def _memoize(func, *args, **kw):
- if kw: # frozenset is used to ensure hashability
- key = args, frozenset(kw.iteritems())
- else:
- key = args
- cache = func.cache # attributed added by memoize
- if key in cache:
- return cache[key]
- else:
- cache[key] = result = func(*args, **kw)
- return result
-
-
-def memoize(f):
- f.cache = {}
- return decorator(_memoize, f)
-
-
-def blocking(not_avail):
- def blocking(f, *args, **kw):
- if not hasattr(f, "thread"): # no thread running
- def set_result():
- f.result = f(*args, **kw)
- f.thread = threading.Thread(None, set_result)
- f.thread.start()
- return not_avail
- elif f.thread.isAlive():
- return not_avail
- else: # the thread is ended, return the stored result
- del f.thread
- return f.result
- return decorator(blocking)
-
-
-class User(object):
- "Will just be able to see a page"
-
-
-class PowerUser(User):
- "Will be able to add new pages too"
-
-
-class Admin(PowerUser):
- "Will be able to delete pages too"
-
-
-def get_userclass():
- return User
-
-
-class PermissionError(Exception):
- pass
-
-
-def restricted(user_class):
- def restricted(func, *args, **kw):
- "Restrict access to a given class of users"
- userclass = get_userclass()
- if issubclass(userclass, user_class):
- return func(*args, **kw)
- else:
- raise PermissionError(
- '%s does not have the permission to run %s!'
- % (userclass.__name__, func.__name__))
- return decorator(restricted)
-
-
-class Action(object):
- """
- >>> a = Action()
- >>> a.view() # ok
- >>> a.insert() # doctest: +IGNORE_EXCEPTION_DETAIL
- Traceback (most recent call last):
- ...
- PermissionError: User does not have the permission to run insert!
- """
- @restricted(User)
- def view(self):
- pass
-
- @restricted(PowerUser)
- def insert(self):
- pass
-
- @restricted(Admin)
- def delete(self):
- pass
-
-
-class TailRecursive(object):
- """
- tail_recursive decorator based on Kay Schluehr's recipe
- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
- with improvements by me and George Sakkis.
- """
-
- def __init__(self, func):
- self.func = func
- self.firstcall = True
- self.CONTINUE = object() # sentinel
-
- def __call__(self, *args, **kwd):
- CONTINUE = self.CONTINUE
- if self.firstcall:
- func = self.func
- self.firstcall = False
- try:
- while True:
- result = func(*args, **kwd)
- if result is CONTINUE: # update arguments
- args, kwd = self.argskwd
- else: # last call
- return result
- finally:
- self.firstcall = True
- else: # return the arguments of the tail call
- self.argskwd = args, kwd
- return CONTINUE
-
-
-def tail_recursive(func):
- return decorator_apply(TailRecursive, func)
-
-
-@tail_recursive
-def factorial(n, acc=1):
- "The good old factorial"
- if n == 0:
- return acc
- return factorial(n-1, n*acc)
-
-
-def fact(n): # this is not tail-recursive
- if n == 0:
- return 1
- return n * fact(n-1)
-
-
-def a_test_for_pylons():
- """
- In version 3.1.0 decorator(caller) returned a nameless partial
- object, thus breaking Pylons. That must not happen again.
-
- >>> decorator(_memoize).__name__
- '_memoize'
-
- Here is another bug of version 3.1.1 missing the docstring:
-
- >>> factorial.__doc__
- 'The good old factorial'
- """
-
-
-def test_kwonlydefaults():
- """
- >>> @trace
- ... def f(arg, defarg=1, *args, kwonly=2): pass
- ...
- >>> f.__kwdefaults__
- {'kwonly': 2}
- """
-
-
-def test_kwonlyargs():
- """
- >>> @trace
- ... def func(a, b, *args, y=2, z=3, **kwargs):
- ... return y, z
- ...
- >>> func('a', 'b', 'c', 'd', 'e', y='y', z='z', cat='dog')
- calling func with args ('a', 'b', 'c', 'd', 'e'), {'cat': 'dog', 'y': 'y', 'z': 'z'}
- ('y', 'z')
- """
-
-
-def test_kwonly_no_args():
- """# this was broken with decorator 3.3.3
- >>> @trace
- ... def f(**kw): pass
- ...
- >>> f()
- calling f with args (), {}
- """
-
-
-def test_kwonly_star_notation():
- """
- >>> @trace
- ... def f(*, a=1, **kw): pass
- ...
- >>> inspect.getfullargspec(f)
- FullArgSpec(args=[], varargs=None, varkw='kw', defaults=None, kwonlyargs=['a'], kwonlydefaults={'a': 1}, annotations={})
- """
-
-
-@contextmanager
-def before_after(before, after):
- print(before)
- yield
- print(after)
-
-ba = before_after('BEFORE', 'AFTER') # ContextManager instance
-
-
-@ba
-def hello(user):
- """
- >>> ba.__class__.__name__
- 'ContextManager'
- >>> hello('michele')
- BEFORE
- hello michele
- AFTER
- """
- print('hello %s' % user)
diff --git a/documentation3.rst b/documentation3.rst
deleted file mode 100644
index 8de9f70..0000000
--- a/documentation3.rst
+++ /dev/null
@@ -1,1054 +0,0 @@
-
-The ``decorator`` module
-=============================================================
-
-:Author: Michele Simionato
-:E-mail: michele.simionato@gmail.com
-:Version: 3.4.1 (2015-03-16)
-:Requires: Python 2.4+
-:Download page: http://pypi.python.org/pypi/decorator/3.4.1
-:Installation: ``easy_install decorator``
-:License: BSD license
-
-.. contents::
-
-Introduction
-------------------------------------------------
-
-Python decorators are an interesting example of why syntactic sugar
-matters. In principle, their introduction in Python 2.4 changed
-nothing, since they do not provide any new functionality which was not
-already present in the language. In practice, their introduction has
-significantly changed the way we structure our programs in Python. I
-believe the change is for the best, and that decorators are a great
-idea since:
-
-* decorators help reducing boilerplate code;
-* decorators help separation of concerns;
-* decorators enhance readability and maintenability;
-* decorators are explicit.
-
-Still, as of now, writing custom decorators correctly requires
-some experience and it is not as easy as it could be. For instance,
-typical implementations of decorators involve nested functions, and
-we all know that flat is better than nested.
-
-The aim of the ``decorator`` module it to simplify the usage of
-decorators for the average programmer, and to popularize decorators by
-showing various non-trivial examples. Of course, as all techniques,
-decorators can be abused (I have seen that) and you should not try to
-solve every problem with a decorator, just because you can.
-
-You may find the source code for all the examples
-discussed here in the ``documentation.py`` file, which contains
-this documentation in the form of doctests.
-
-Definitions
-------------------------------------
-
-Technically speaking, any Python object which can be called with one argument
-can be used as a decorator. However, this definition is somewhat too large
-to be really useful. It is more convenient to split the generic class of
-decorators in two subclasses:
-
-+ *signature-preserving* decorators, i.e. callable objects taking a
- function as input and returning a function *with the same
- signature* as output;
-
-+ *signature-changing* decorators, i.e. decorators that change
- the signature of their input function, or decorators returning
- non-callable objects.
-
-Signature-changing decorators have their use: for instance the
-builtin classes ``staticmethod`` and ``classmethod`` are in this
-group, since they take functions and return descriptor objects which
-are not functions, nor callables.
-
-However, signature-preserving decorators are more common and easier to
-reason about; in particular signature-preserving decorators can be
-composed together whereas other decorators in general cannot.
-
-Writing signature-preserving decorators from scratch is not that
-obvious, especially if one wants to define proper decorators that
-can accept functions with any signature. A simple example will clarify
-the issue.
-
-Statement of the problem
-------------------------------
-
-A very common use case for decorators is the memoization of functions.
-A ``memoize`` decorator works by caching
-the result of the function call in a dictionary, so that the next time
-the function is called with the same input parameters the result is retrieved
-from the cache and not recomputed. There are many implementations of
-``memoize`` in http://www.python.org/moin/PythonDecoratorLibrary,
-but they do not preserve the signature.
-A simple implementation could be the following (notice
-that in general it is impossible to memoize correctly something
-that depends on non-hashable arguments):
-
-.. code-block:: python
-
- def memoize_uw(func):
- func.cache = {}
-
- def memoize(*args, **kw):
- if kw: # frozenset is used to ensure hashability
- key = args, frozenset(kw.iteritems())
- else:
- key = args
- cache = func.cache
- if key in cache:
- return cache[key]
- else:
- cache[key] = result = func(*args, **kw)
- return result
- return functools.update_wrapper(memoize, func)
-
-
-Here we used the functools.update_wrapper_ utility, which has
-been added in Python 2.5 expressly to simplify the definition of decorators
-(in older versions of Python you need to copy the function attributes
-``__name__``, ``__doc__``, ``__module__`` and ``__dict__``
-from the original function to the decorated function by hand).
-
-.. _functools.update_wrapper: https://docs.python.org/3/library/functools.html#functools.update_wrapper
-
-The implementation above works in the sense that the decorator
-can accept functions with generic signatures; unfortunately this
-implementation does *not* define a signature-preserving decorator, since in
-general ``memoize_uw`` returns a function with a
-*different signature* from the original function.
-
-Consider for instance the following case:
-
-.. code-block:: python
-
- >>> @memoize_uw
- ... def f1(x):
- ... time.sleep(1) # simulate some long computation
- ... return x
-
-Here the original function takes a single argument named ``x``,
-but the decorated function takes any number of arguments and
-keyword arguments:
-
-.. code-block:: python
-
- >>> from inspect import getargspec
- >>> print(getargspec(f1))
- ArgSpec(args=[], varargs='args', keywords='kw', defaults=None)
-
-This means that introspection tools such as pydoc will give
-wrong informations about the signature of ``f1``. This is pretty bad:
-pydoc will tell you that the function accepts a generic signature
-``*args``, ``**kw``, but when you try to call the function with more than an
-argument, you will get an error:
-
-.. code-block:: python
-
- >>> f1(0, 1)
- Traceback (most recent call last):
- ...
- TypeError: f1() takes exactly 1 positional argument (2 given)
-
-The solution
------------------------------------------
-
-The solution is to provide a generic factory of generators, which
-hides the complexity of making signature-preserving decorators
-from the application programmer. The ``decorator`` function in
-the ``decorator`` module is such a factory:
-
-.. code-block:: python
-
- >>> from decorator import decorator
-
-``decorator`` takes two arguments, a caller function describing the
-functionality of the decorator and a function to be decorated; it
-returns the decorated function. The caller function must have
-signature ``(f, *args, **kw)`` and it must call the original function ``f``
-with arguments ``args`` and ``kw``, implementing the wanted capability,
-i.e. memoization in this case:
-
-.. code-block:: python
-
- def _memoize(func, *args, **kw):
- if kw: # frozenset is used to ensure hashability
- key = args, frozenset(kw.iteritems())
- else:
- key = args
- cache = func.cache # attributed added by memoize
- if key in cache:
- return cache[key]
- else:
- cache[key] = result = func(*args, **kw)
- return result
-
-
-At this point you can define your decorator as follows:
-
-.. code-block:: python
-
- def memoize(f):
- f.cache = {}
- return decorator(_memoize, f)
-
-
-The difference with respect to the ``memoize_uw`` approach, which is based
-on nested functions, is that the decorator module forces you to lift
-the inner function at the outer level (*flat is better than nested*).
-Moreover, you are forced to pass explicitly the function you want to
-decorate to the caller function.
-
-Here is a test of usage:
-
-.. code-block:: python
-
- >>> @memoize
- ... def heavy_computation():
- ... time.sleep(2)
- ... return "done"
-
- >>> print(heavy_computation()) # the first time it will take 2 seconds
- done
-
- >>> print(heavy_computation()) # the second time it will be instantaneous
- done
-
-The signature of ``heavy_computation`` is the one you would expect:
-
-.. code-block:: python
-
- >>> print(getargspec(heavy_computation))
- ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
-
-A ``trace`` decorator
-------------------------------------------------------
-
-As an additional example, here is how you can define a trivial
-``trace`` decorator, which prints a message everytime the traced
-function is called:
-
-.. code-block:: python
-
- def _trace(f, *args, **kw):
- kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
- print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
- return f(*args, **kw)
-
-
-.. code-block:: python
-
- def trace(f):
- return decorator(_trace, f)
-
-
-Here is an example of usage:
-
-.. code-block:: python
-
- >>> @trace
- ... def f1(x):
- ... pass
-
-It is immediate to verify that ``f1`` works
-
-.. code-block:: python
-
- >>> f1(0)
- calling f1 with args (0,), {}
-
-and it that it has the correct signature:
-
-.. code-block:: python
-
- >>> print(getargspec(f1))
- ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
-
-The same decorator works with functions of any signature:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(x, y=1, z=2, *args, **kw):
- ... pass
-
- >>> f(0, 3)
- calling f with args (0, 3, 2), {}
-
- >>> print(getargspec(f))
- ArgSpec(args=['x', 'y', 'z'], varargs='args', keywords='kw', defaults=(1, 2))
-
-Function annotations
----------------------------------------------
-
-Python 3 introduced the concept of `function annotations`_,i.e. the ability
-to annotate the signature of a function with additional information,
-stored in a dictionary named ``__annotations__``. The decorator module,
-starting from release 3.3, is able to understand and to preserve the
-annotations. Here is an example:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(x: 'the first argument', y: 'default argument'=1, z=2,
- ... *args: 'varargs', **kw: 'kwargs'):
- ... pass
-
-In order to introspect functions with annotations, one needs the
-utility ``inspect.getfullargspec``, new in Python 3:
-
-.. code-block:: python
-
- >>> from inspect import getfullargspec
- >>> argspec = getfullargspec(f)
- >>> argspec.args
- ['x', 'y', 'z']
- >>> argspec.varargs
- 'args'
- >>> argspec.varkw
- 'kw'
- >>> argspec.defaults
- (1, 2)
- >>> argspec.kwonlyargs
- []
- >>> argspec.kwonlydefaults
-
-You can also check that the ``__annotations__`` dictionary is preserved:
-
-.. code-block:: python
-
- >>> f.__annotations__ == f.__wrapped__.__annotations__
- True
-
-Depending on the version of the decorator module, the two dictionaries can
-be the same object or not: you cannot rely on object identity, but you can
-rely on the content being the same.
-
-``decorator`` is a decorator
----------------------------------------------
-
-It may be annoying to write a caller function (like the ``_trace``
-function above) and then a trivial wrapper
-(``def trace(f): return decorator(_trace, f)``) every time. For this reason,
-the ``decorator`` module provides an easy shortcut to convert
-the caller function into a signature-preserving decorator:
-you can just call ``decorator`` with a single argument.
-In our example you can just write ``trace = decorator(_trace)``.
-The ``decorator`` function can also be used as a signature-changing
-decorator, just as ``classmethod`` and ``staticmethod``.
-However, ``classmethod`` and ``staticmethod`` return generic
-objects which are not callable, while ``decorator`` returns
-signature-preserving decorators, i.e. functions of a single argument.
-For instance, you can write directly
-
-.. code-block:: python
-
- >>> @decorator
- ... def trace(f, *args, **kw):
- ... kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw))
- ... print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr))
- ... return f(*args, **kw)
-
-and now ``trace`` will be a decorator. Actually ``trace`` is a ``partial``
-object which can be used as a decorator:
-
-.. code-block:: python
-
- >>> trace
- <function trace at 0x...>
-
-Here is an example of usage:
-
-.. code-block:: python
-
- >>> @trace
- ... def func(): pass
-
- >>> func()
- calling func with args (), {}
-
-If you are using an old Python version (Python 2.4) the
-``decorator`` module provides a poor man replacement for
-``functools.partial``.
-
-``blocking``
--------------------------------------------
-
-Sometimes one has to deal with blocking resources, such as ``stdin``, and
-sometimes it is best to have back a "busy" message than to block everything.
-This behavior can be implemented with a suitable family of decorators,
-where the parameter is the busy message:
-
-.. code-block:: python
-
- def blocking(not_avail):
- def blocking(f, *args, **kw):
- if not hasattr(f, "thread"): # no thread running
- def set_result():
- f.result = f(*args, **kw)
- f.thread = threading.Thread(None, set_result)
- f.thread.start()
- return not_avail
- elif f.thread.isAlive():
- return not_avail
- else: # the thread is ended, return the stored result
- del f.thread
- return f.result
- return decorator(blocking)
-
-
-Functions decorated with ``blocking`` will return a busy message if
-the resource is unavailable, and the intended result if the resource is
-available. For instance:
-
-.. code-block:: python
-
- >>> @blocking("Please wait ...")
- ... def read_data():
- ... time.sleep(3) # simulate a blocking resource
- ... return "some data"
-
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1)
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1)
- >>> print(read_data()) # data is not available yet
- Please wait ...
-
- >>> time.sleep(1.1) # after 3.1 seconds, data is available
- >>> print(read_data())
- some data
-
-``async``
---------------------------------------------
-
-We have just seen an examples of a simple decorator factory,
-implemented as a function returning a decorator.
-For more complex situations, it is more
-convenient to implement decorator factories as classes returning
-callable objects that can be converted into decorators.
-
-As an example, here will I show a decorator
-which is able to convert a blocking function into an asynchronous
-function. The function, when called,
-is executed in a separate thread. Moreover, it is possible to set
-three callbacks ``on_success``, ``on_failure`` and ``on_closing``,
-to specify how to manage the function call (of course the code here
-is just an example, it is not a recommended way of doing multi-threaded
-programming). The implementation is the following:
-
-.. code-block:: python
-
- def on_success(result): # default implementation
- "Called on the result of the function"
- return result
-
-.. code-block:: python
-
- def on_failure(exc_info): # default implementation
- "Called if the function fails"
- pass
-
-.. code-block:: python
-
- def on_closing(): # default implementation
- "Called at the end, both in case of success and failure"
- pass
-
-.. code-block:: python
-
- class Async(object):
- """
- A decorator converting blocking functions into asynchronous
- functions, by using threads or processes. Examples:
-
- async_with_threads = Async(threading.Thread)
- async_with_processes = Async(multiprocessing.Process)
- """
-
- def __init__(self, threadfactory, on_success=on_success,
- on_failure=on_failure, on_closing=on_closing):
- self.threadfactory = threadfactory
- self.on_success = on_success
- self.on_failure = on_failure
- self.on_closing = on_closing
-
- def __call__(self, func, *args, **kw):
- try:
- counter = func.counter
- except AttributeError: # instantiate the counter at the first call
- counter = func.counter = itertools.count(1)
- name = '%s-%s' % (func.__name__, next(counter))
-
- def func_wrapper():
- try:
- result = func(*args, **kw)
- except:
- self.on_failure(sys.exc_info())
- else:
- return self.on_success(result)
- finally:
- self.on_closing()
- thread = self.threadfactory(None, func_wrapper, name)
- thread.start()
- return thread
-
-
-The decorated function returns
-the current execution thread, which can be stored and checked later, for
-instance to verify that the thread ``.isAlive()``.
-
-Here is an example of usage. Suppose one wants to write some data to
-an external resource which can be accessed by a single user at once
-(for instance a printer). Then the access to the writing function must
-be locked. Here is a minimalistic example:
-
-.. code-block:: python
-
- >>> async = decorator(Async(threading.Thread))
-
- >>> datalist = [] # for simplicity the written data are stored into a list.
-
- >>> @async
- ... def write(data):
- ... # append data to the datalist by locking
- ... with threading.Lock():
- ... time.sleep(1) # emulate some long running operation
- ... datalist.append(data)
- ... # other operations not requiring a lock here
-
-Each call to ``write`` will create a new writer thread, but there will
-be no synchronization problems since ``write`` is locked.
-
-.. code-block:: python
-
- >>> write("data1")
- <Thread(write-1, started...)>
-
- >>> time.sleep(.1) # wait a bit, so we are sure data2 is written after data1
-
- >>> write("data2")
- <Thread(write-2, started...)>
-
- >>> time.sleep(2) # wait for the writers to complete
-
- >>> print(datalist)
- ['data1', 'data2']
-
-contextmanager
--------------------------------------
-
-For a long time Python had in its standard library a ``contextmanager``
-decorator, able to convert generator functions into
-``_GeneratorContextManager`` factories. For instance if you write
-
-.. code-block:: python
-
- >>> from contextlib import contextmanager
- >>> @contextmanager
- ... def before_after(before, after):
- ... print(before)
- ... yield
- ... print(after)
-
-
-then ``before_after`` is a factory function returning
-``_GeneratorContextManager`` objects which can be used with
-the ``with`` statement:
-
-.. code-block:: python
-
- >>> ba = before_after('BEFORE', 'AFTER')
- >>> type(ba)
- <class 'contextlib._GeneratorContextManager'>
- >>> with ba:
- ... print('hello')
- BEFORE
- hello
- AFTER
-
-Basically, it is as if the content of the ``with`` block was executed
-in the place of the ``yield`` expression in the generator function.
-In Python 3.2 ``_GeneratorContextManager``
-objects were enhanced with a ``__call__``
-method, so that they can be used as decorators as in this example:
-
-.. code-block:: python
-
- >>> @ba
- ... def hello():
- ... print('hello')
- ...
- >>> hello()
- BEFORE
- hello
- AFTER
-
-The ``ba`` decorator is basically inserting a ``with ba:``
-block inside the function.
-However there two issues: the first is that ``_GeneratorContextManager``
-objects are callable only in Python 3.2, so the previous example will break
-in older versions of Python; the second is that
-``_GeneratorContextManager`` objects do not preserve the signature
-of the decorated functions: the decorated ``hello`` function here will have
-a generic signature ``hello(*args, **kwargs)`` but will break when
-called with more than zero arguments. For such reasons the decorator
-module, starting with release 3.4, offers a ``decorator.contextmanager``
-decorator that solves both problems and works even in Python 2.5.
-The usage is the same and factories decorated with ``decorator.contextmanager``
-will returns instances of ``ContextManager``, a subclass of
-``contextlib._GeneratorContextManager`` with a ``__call__`` method
-acting as a signature-preserving decorator.
-
-The ``FunctionMaker`` class
----------------------------------------------------------------
-
-You may wonder about how the functionality of the ``decorator`` module
-is implemented. The basic building block is
-a ``FunctionMaker`` class which is able to generate on the fly
-functions with a given name and signature from a function template
-passed as a string. Generally speaking, you should not need to
-resort to ``FunctionMaker`` when writing ordinary decorators, but
-it is handy in some circumstances. You will see an example shortly, in
-the implementation of a cool decorator utility (``decorator_apply``).
-
-``FunctionMaker`` provides a ``.create`` classmethod which
-takes as input the name, signature, and body of the function
-we want to generate as well as the execution environment
-were the function is generated by ``exec``. Here is an example:
-
-.. code-block:: python
-
- >>> def f(*args, **kw): # a function with a generic signature
- ... print(args, kw)
-
- >>> f1 = FunctionMaker.create('f1(a, b)', 'f(a, b)', dict(f=f))
- >>> f1(1,2)
- (1, 2) {}
-
-It is important to notice that the function body is interpolated
-before being executed, so be careful with the ``%`` sign!
-
-``FunctionMaker.create`` also accepts keyword arguments and such
-arguments are attached to the resulting function. This is useful
-if you want to set some function attributes, for instance the
-docstring ``__doc__``.
-
-For debugging/introspection purposes it may be useful to see
-the source code of the generated function; to do that, just
-pass the flag ``addsource=True`` and a ``__source__`` attribute will
-be added to the generated function:
-
-.. code-block:: python
-
- >>> f1 = FunctionMaker.create(
- ... 'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True)
- >>> print(f1.__source__)
- def f1(a, b):
- f(a, b)
- <BLANKLINE>
-
-``FunctionMaker.create`` can take as first argument a string,
-as in the examples before, or a function. This is the most common
-usage, since typically you want to decorate a pre-existing
-function. A framework author may want to use directly ``FunctionMaker.create``
-instead of ``decorator``, since it gives you direct access to the body
-of the generated function. For instance, suppose you want to instrument
-the ``__init__`` methods of a set of classes, by preserving their
-signature (such use case is not made up; this is done in SQAlchemy
-and in other frameworks). When the first argument of ``FunctionMaker.create``
-is a function, a ``FunctionMaker`` object is instantiated internally,
-with attributes ``args``, ``varargs``,
-``keywords`` and ``defaults`` which are the
-the return values of the standard library function ``inspect.getargspec``.
-For each argument in the ``args`` (which is a list of strings containing
-the names of the mandatory arguments) an attribute ``arg0``, ``arg1``,
-..., ``argN`` is also generated. Finally, there is a ``signature``
-attribute, a string with the signature of the original function.
-
-Notice that while I do not have plans
-to change or remove the functionality provided in the
-``FunctionMaker`` class, I do not guarantee that it will stay
-unchanged forever. For instance, right now I am using the traditional
-string interpolation syntax for function templates, but Python 2.6
-and Python 3.0 provide a newer interpolation syntax and I may use
-the new syntax in the future.
-On the other hand, the functionality provided by
-``decorator`` has been there from version 0.1 and it is guaranteed to
-stay there forever.
-
-Getting the source code
----------------------------------------------------
-
-Internally ``FunctionMaker.create`` uses ``exec`` to generate the
-decorated function. Therefore
-``inspect.getsource`` will not work for decorated functions. That
-means that the usual '??' trick in IPython will give you the (right on
-the spot) message ``Dynamically generated function. No source code
-available``. In the past I have considered this acceptable, since
-``inspect.getsource`` does not really work even with regular
-decorators. In that case ``inspect.getsource`` gives you the wrapper
-source code which is probably not what you want:
-
-.. code-block:: python
-
- def identity_dec(func):
- def wrapper(*args, **kw):
- return func(*args, **kw)
- return wrapper
-
-
-.. code-block:: python
-
- @identity_dec
- def example(): pass
-
- >>> print(inspect.getsource(example))
- def wrapper(*args, **kw):
- return func(*args, **kw)
- <BLANKLINE>
-
-(see bug report 1764286_ for an explanation of what is happening).
-Unfortunately the bug is still there, even in Python 2.7 and 3.1.
-There is however a workaround. The decorator module adds an
-attribute ``.__wrapped__`` to the decorated function, containing
-a reference to the original function. The easy way to get
-the source code is to call ``inspect.getsource`` on the
-undecorated function:
-
-.. code-block:: python
-
- >>> print(inspect.getsource(factorial.__wrapped__))
- @tail_recursive
- def factorial(n, acc=1):
- "The good old factorial"
- if n == 0:
- return acc
- return factorial(n-1, n*acc)
- <BLANKLINE>
-
-.. _1764286: http://bugs.python.org/issue1764286
-
-Dealing with third party decorators
------------------------------------------------------------------
-
-Sometimes you find on the net some cool decorator that you would
-like to include in your code. However, more often than not the cool
-decorator is not signature-preserving. Therefore you may want an easy way to
-upgrade third party decorators to signature-preserving decorators without
-having to rewrite them in terms of ``decorator``. You can use a
-``FunctionMaker`` to implement that functionality as follows:
-
-.. code-block:: python
-
- def decorator_apply(dec, func):
- """
- Decorate a function by preserving the signature even if dec
- is not a signature-preserving decorator.
- """
- return FunctionMaker.create(
- func, 'return decorated(%(signature)s)',
- dict(decorated=dec(func)), __wrapped__=func)
-
-
-``decorator_apply`` sets the attribute ``.__wrapped__`` of the generated
-function to the original function, so that you can get the right
-source code.
-
-Notice that I am not providing this functionality in the ``decorator``
-module directly since I think it is best to rewrite the decorator rather
-than adding an additional level of indirection. However, practicality
-beats purity, so you can add ``decorator_apply`` to your toolbox and
-use it if you need to.
-
-In order to give an example of usage of ``decorator_apply``, I will show a
-pretty slick decorator that converts a tail-recursive function in an iterative
-function. I have shamelessly stolen the basic idea from Kay Schluehr's recipe
-in the Python Cookbook,
-http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691.
-
-.. code-block:: python
-
- class TailRecursive(object):
- """
- tail_recursive decorator based on Kay Schluehr's recipe
- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691
- with improvements by me and George Sakkis.
- """
-
- def __init__(self, func):
- self.func = func
- self.firstcall = True
- self.CONTINUE = object() # sentinel
-
- def __call__(self, *args, **kwd):
- CONTINUE = self.CONTINUE
- if self.firstcall:
- func = self.func
- self.firstcall = False
- try:
- while True:
- result = func(*args, **kwd)
- if result is CONTINUE: # update arguments
- args, kwd = self.argskwd
- else: # last call
- return result
- finally:
- self.firstcall = True
- else: # return the arguments of the tail call
- self.argskwd = args, kwd
- return CONTINUE
-
-
-Here the decorator is implemented as a class returning callable
-objects.
-
-.. code-block:: python
-
- def tail_recursive(func):
- return decorator_apply(TailRecursive, func)
-
-
-Here is how you apply the upgraded decorator to the good old factorial:
-
-.. code-block:: python
-
- @tail_recursive
- def factorial(n, acc=1):
- "The good old factorial"
- if n == 0:
- return acc
- return factorial(n-1, n*acc)
-
-
-.. code-block:: python
-
- >>> print(factorial(4))
- 24
-
-This decorator is pretty impressive, and should give you some food for
-your mind ;) Notice that there is no recursion limit now, and you can
-easily compute ``factorial(1001)`` or larger without filling the stack
-frame. Notice also that the decorator will not work on functions which
-are not tail recursive, such as the following
-
-.. code-block:: python
-
- def fact(n): # this is not tail-recursive
- if n == 0:
- return 1
- return n * fact(n-1)
-
-
-(reminder: a function is tail recursive if it either returns a value without
-making a recursive call, or returns directly the result of a recursive
-call).
-
-Caveats and limitations
--------------------------------------------
-
-The first thing you should be aware of, it the fact that decorators
-have a performance penalty.
-The worse case is shown by the following example::
-
- $ cat performance.sh
- python3 -m timeit -s "
- from decorator import decorator
-
- @decorator
- def do_nothing(func, *args, **kw):
- return func(*args, **kw)
-
- @do_nothing
- def f():
- pass
- " "f()"
-
- python3 -m timeit -s "
- def f():
- pass
- " "f()"
-
-On my MacBook, using the ``do_nothing`` decorator instead of the
-plain function is more than three times slower::
-
- $ bash performance.sh
- 1000000 loops, best of 3: 0.669 usec per loop
- 1000000 loops, best of 3: 0.181 usec per loop
-
-It should be noted that a real life function would probably do
-something more useful than ``f`` here, and therefore in real life the
-performance penalty could be completely negligible. As always, the
-only way to know if there is
-a penalty in your specific use case is to measure it.
-
-You should be aware that decorators will make your tracebacks
-longer and more difficult to understand. Consider this example:
-
-.. code-block:: python
-
- >>> @trace
- ... def f():
- ... 1/0
-
-Calling ``f()`` will give you a ``ZeroDivisionError``, but since the
-function is decorated the traceback will be longer:
-
-.. code-block:: python
-
- >>> f()
- Traceback (most recent call last):
- ...
- File "<string>", line 2, in f
- File "<doctest __main__[22]>", line 4, in trace
- return f(*args, **kw)
- File "<doctest __main__[51]>", line 3, in f
- 1/0
- ZeroDivisionError: ...
-
-You see here the inner call to the decorator ``trace``, which calls
-``f(*args, **kw)``, and a reference to ``File "<string>", line 2, in f``.
-This latter reference is due to the fact that internally the decorator
-module uses ``exec`` to generate the decorated function. Notice that
-``exec`` is *not* responsibile for the performance penalty, since is the
-called *only once* at function decoration time, and not every time
-the decorated function is called.
-
-At present, there is no clean way to avoid ``exec``. A clean solution
-would require to change the CPython implementation of functions and
-add an hook to make it possible to change their signature directly.
-That could happen in future versions of Python (see PEP 362_) and
-then the decorator module would become obsolete. However, at present,
-even in Python 3.2 it is impossible to change the function signature
-directly, therefore the ``decorator`` module is still useful.
-Actually, this is one of the main reasons why I keep maintaining
-the module and releasing new versions.
-
-.. _362: http://www.python.org/dev/peps/pep-0362
-
-In the present implementation, decorators generated by ``decorator``
-can only be used on user-defined Python functions or methods, not on generic
-callable objects, nor on built-in functions, due to limitations of the
-``inspect`` module in the standard library.
-
-There is a restriction on the names of the arguments: for instance,
-if try to call an argument ``_call_`` or ``_func_``
-you will get a ``NameError``:
-
-.. code-block:: python
-
- >>> @trace
- ... def f(_func_): print(f)
- ...
- Traceback (most recent call last):
- ...
- NameError: _func_ is overridden in
- def f(_func_):
- return _call_(_func_, _func_)
-
-Finally, the implementation is such that the decorated function shares
-the original function dictionary:
-
-.. code-block:: python
-
- >>> def f(): pass # the original function
- >>> f.attr1 = "something" # setting an attribute
- >>> f.attr2 = "something else" # setting another attribute
-
- >>> traced_f = trace(f) # the decorated function
-
- >>> traced_f.attr1
- 'something'
- >>> traced_f.attr2 = "something different" # setting attr
- >>> f.attr2 # the original attribute did not change
- 'something else'
-
-Compatibility notes
----------------------------------------------------------------
-
-Version 3.4 fixes some bugs in the support of recent versions of
-Python 3. Version 3.3 was the first version of the ``decorator``
-module to fully support Python 3, including `function
-annotations`_. Version 3.2 was the first version to support Python 3
-via the ``2to3`` conversion tool. The hard work (for me) has been
-converting the documentation and the doctests. This has been possible
-only after that docutils_ and pygments_ have been ported to Python 3.
-
-Version 3 of the ``decorator`` module do not contain any backward
-incompatible change, apart from the removal of the functions
-``get_info`` and ``new_wrapper``, which have been deprecated for
-years. ``get_info`` has been removed since it was little used and
-since it had to be changed anyway to work with Python 3.0;
-``new_wrapper`` has been removed since it was useless: its major use
-case (converting signature changing decorators to signature preserving
-decorators) has been subsumed by ``decorator_apply``, whereas the other use
-case can be managed with the ``FunctionMaker``.
-
-There are a few changes in the documentation: I removed the
-``decorator_factory`` example, which was confusing some of my users,
-and I removed the part about exotic signatures in the Python 3
-documentation, since Python 3 does not support them.
-
-Finally ``decorator`` cannot be used as a class decorator and the
-`functionality introduced in version 2.3`_ has been removed. That
-means that in order to define decorator factories with classes you
-need to define the ``__call__`` method explicitly (no magic anymore).
-All these changes should not cause any trouble, since they were
-all rarely used features. Should you have any trouble, you can always
-downgrade to the 2.3 version.
-
-The examples shown here have been tested with Python 2.6. Python 2.4
-is also supported - of course the examples requiring the ``with``
-statement will not work there. Python 2.5 works fine, but if you
-run the examples in the interactive interpreter
-you will notice a few differences since
-``getargspec`` returns an ``ArgSpec`` namedtuple instead of a regular
-tuple. That means that running the file
-``documentation.py`` under Python 2.5 will print a few errors, but
-they are not serious.
-
-.. _functionality introduced in version 2.3: http://www.phyast.pitt.edu/~micheles/python/documentation.html#class-decorators-and-decorator-factories
-.. _function annotations: http://www.python.org/dev/peps/pep-3107/
-.. _distribute: http://packages.python.org/distribute/
-.. _docutils: http://docutils.sourceforge.net/
-.. _pygments: http://pygments.org/
-
-LICENCE
----------------------------------------------
-
-Copyright (c) 2005-2015, Michele Simionato
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- Redistributions in bytecode form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-If you use this software and you are happy with it, consider sending me a
-note, just to gratify my ego. On the other hand, if you use this software and
-you are unhappy with it, send me a patch!
diff --git a/src/decorator.py b/src/decorator.py
index 2e14027..96de525 100644
--- a/src/decorator.py
+++ b/src/decorator.py
@@ -244,7 +244,7 @@ def decorator(caller, func=None):
# ####################### contextmanager ####################### #
def __call__(self, func):
- 'Context manager decorator'
+ """Context manager decorator"""
return FunctionMaker.create(
func, "with _self_: return _func_(%(shortsignature)s)",
dict(_self_=self, _func_=func), __wrapped__=func)
@@ -258,17 +258,11 @@ try: # Python >= 3.2
except ImportError: # Python >= 2.5
- try:
- from contextlib import GeneratorContextManager
- except ImportError: # Python 2.4
- class ContextManager(object):
- def __init__(self, g, *a, **k):
- raise RuntimeError(
- 'You cannot used contextmanager in Python 2.4!')
- else:
- class ContextManager(GeneratorContextManager):
- def __init__(self, g, *a, **k):
- return GeneratorContextManager.__init__(self, g(*a, **k))
- __call__ = __call__
+ from contextlib import GeneratorContextManager
+
+ class ContextManager(GeneratorContextManager):
+ def __init__(self, g, *a, **k):
+ return GeneratorContextManager.__init__(self, g(*a, **k))
+ __call__ = __call__
contextmanager = decorator(ContextManager)
diff --git a/test.py b/test.py
index ed9873b..cf6dd3d 100644
--- a/test.py
+++ b/test.py
@@ -6,6 +6,7 @@ import os
import sys
import doctest
from decorator import decorator
+import documentation
@decorator
@@ -37,11 +38,5 @@ if __name__ == '__main__':
for name, test in list(globals().items()):
if name.startswith('test'):
test()
-
- if sys.version >= '3':
- import documentation3 as doc
- else:
- import documentation as doc
-
- err = doctest.testmod(doc)[0]
+ err = doctest.testmod(documentation)[0]
sys.exit(err)