home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CR line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CR]
| default (weak)
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [R*ch] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 44 61 74 61 20 6d 6f |\chapter|{Data mo|
|00000010| 64 65 6c 7d 0d 0d 5c 73 | 65 63 74 69 6f 6e 7b 4f |del}..\s|ection{O|
|00000020| 62 6a 65 63 74 73 2c 20 | 76 61 6c 75 65 73 20 61 |bjects, |values a|
|00000030| 6e 64 20 74 79 70 65 73 | 7d 0d 0d 7b 5c 65 6d 20 |nd types|}..{\em |
|00000040| 4f 62 6a 65 63 74 73 7d | 20 61 72 65 20 50 79 74 |Objects}| are Pyt|
|00000050| 68 6f 6e 27 73 20 61 62 | 73 74 72 61 63 74 69 6f |hon's ab|stractio|
|00000060| 6e 20 66 6f 72 20 64 61 | 74 61 2e 20 20 41 6c 6c |n for da|ta. All|
|00000070| 20 64 61 74 61 20 69 6e | 20 61 20 50 79 74 68 6f | data in| a Pytho|
|00000080| 6e 0d 70 72 6f 67 72 61 | 6d 20 69 73 20 72 65 70 |n.progra|m is rep|
|00000090| 72 65 73 65 6e 74 65 64 | 20 62 79 20 6f 62 6a 65 |resented| by obje|
|000000a0| 63 74 73 20 6f 72 20 62 | 79 20 72 65 6c 61 74 69 |cts or b|y relati|
|000000b0| 6f 6e 73 20 62 65 74 77 | 65 65 6e 20 6f 62 6a 65 |ons betw|een obje|
|000000c0| 63 74 73 2e 0d 28 49 6e | 20 61 20 73 65 6e 73 65 |cts..(In| a sense|
|000000d0| 2c 20 61 6e 64 20 69 6e | 20 63 6f 6e 66 6f 72 6d |, and in| conform|
|000000e0| 61 6e 63 65 20 74 6f 20 | 56 6f 6e 20 4e 65 75 6d |ance to |Von Neum|
|000000f0| 61 6e 6e 27 73 20 6d 6f | 64 65 6c 20 6f 66 20 61 |ann's mo|del of a|
|00000100| 0d 60 60 73 74 6f 72 65 | 64 20 70 72 6f 67 72 61 |.``store|d progra|
|00000110| 6d 20 63 6f 6d 70 75 74 | 65 72 27 27 2c 20 63 6f |m comput|er'', co|
|00000120| 64 65 20 69 73 20 61 6c | 73 6f 20 72 65 70 72 65 |de is al|so repre|
|00000130| 73 65 6e 74 65 64 20 62 | 79 20 6f 62 6a 65 63 74 |sented b|y object|
|00000140| 73 2e 29 0d 5c 69 6e 64 | 65 78 7b 6f 62 6a 65 63 |s.).\ind|ex{objec|
|00000150| 74 7d 0d 5c 69 6e 64 65 | 78 7b 64 61 74 61 7d 0d |t}.\inde|x{data}.|
|00000160| 0d 45 76 65 72 79 20 6f | 62 6a 65 63 74 20 68 61 |.Every o|bject ha|
|00000170| 73 20 61 6e 20 69 64 65 | 6e 74 69 74 79 2c 20 61 |s an ide|ntity, a|
|00000180| 20 74 79 70 65 20 61 6e | 64 20 61 20 76 61 6c 75 | type an|d a valu|
|00000190| 65 2e 20 20 41 6e 20 6f | 62 6a 65 63 74 27 73 20 |e. An o|bject's |
|000001a0| 7b 5c 65 6d 0d 69 64 65 | 6e 74 69 74 79 7d 20 6e |{\em.ide|ntity} n|
|000001b0| 65 76 65 72 20 63 68 61 | 6e 67 65 73 20 6f 6e 63 |ever cha|nges onc|
|000001c0| 65 20 69 74 20 68 61 73 | 20 62 65 65 6e 20 63 72 |e it has| been cr|
|000001d0| 65 61 74 65 64 3b 20 79 | 6f 75 20 6d 61 79 20 74 |eated; y|ou may t|
|000001e0| 68 69 6e 6b 20 6f 66 20 | 69 74 0d 61 73 20 74 68 |hink of |it.as th|
|000001f0| 65 20 6f 62 6a 65 63 74 | 27 73 20 61 64 64 72 65 |e object|'s addre|
|00000200| 73 73 20 69 6e 20 6d 65 | 6d 6f 72 79 2e 20 20 41 |ss in me|mory. A|
|00000210| 6e 20 6f 62 6a 65 63 74 | 27 73 20 7b 5c 65 6d 20 |n object|'s {\em |
|00000220| 74 79 70 65 7d 20 69 73 | 20 61 6c 73 6f 0d 75 6e |type} is| also.un|
|00000230| 63 68 61 6e 67 65 61 62 | 6c 65 2e 20 20 49 74 20 |changeab|le. It |
|00000240| 64 65 74 65 72 6d 69 6e | 65 73 20 74 68 65 20 6f |determin|es the o|
|00000250| 70 65 72 61 74 69 6f 6e | 73 20 74 68 61 74 20 61 |peration|s that a|
|00000260| 6e 20 6f 62 6a 65 63 74 | 20 73 75 70 70 6f 72 74 |n object| support|
|00000270| 73 0d 28 65 2e 67 2e 20 | 60 60 64 6f 65 73 20 69 |s.(e.g. |``does i|
|00000280| 74 20 68 61 76 65 20 61 | 20 6c 65 6e 67 74 68 3f |t have a| length?|
|00000290| 27 27 29 20 61 6e 64 20 | 61 6c 73 6f 20 64 65 66 |'') and |also def|
|000002a0| 69 6e 65 73 20 74 68 65 | 20 70 6f 73 73 69 62 6c |ines the| possibl|
|000002b0| 65 0d 76 61 6c 75 65 73 | 20 66 6f 72 20 6f 62 6a |e.values| for obj|
|000002c0| 65 63 74 73 20 6f 66 20 | 74 68 61 74 20 74 79 70 |ects of |that typ|
|000002d0| 65 2e 20 20 54 68 65 20 | 7b 5c 65 6d 20 76 61 6c |e. The |{\em val|
|000002e0| 75 65 7d 20 6f 66 20 73 | 6f 6d 65 20 6f 62 6a 65 |ue} of s|ome obje|
|000002f0| 63 74 73 20 63 61 6e 0d | 63 68 61 6e 67 65 2e 20 |cts can.|change. |
|00000300| 20 4f 62 6a 65 63 74 73 | 20 77 68 6f 73 65 20 76 | Objects| whose v|
|00000310| 61 6c 75 65 20 63 61 6e | 20 63 68 61 6e 67 65 20 |alue can| change |
|00000320| 61 72 65 20 73 61 69 64 | 20 74 6f 20 62 65 20 7b |are said| to be {|
|00000330| 5c 65 6d 20 6d 75 74 61 | 62 6c 65 7d 3b 0d 6f 62 |\em muta|ble};.ob|
|00000340| 6a 65 63 74 73 20 77 68 | 6f 73 65 20 76 61 6c 75 |jects wh|ose valu|
|00000350| 65 20 69 73 20 75 6e 63 | 68 61 6e 67 65 61 62 6c |e is unc|hangeabl|
|00000360| 65 20 6f 6e 63 65 20 74 | 68 65 79 20 61 72 65 20 |e once t|hey are |
|00000370| 63 72 65 61 74 65 64 20 | 61 72 65 20 63 61 6c 6c |created |are call|
|00000380| 65 64 0d 7b 5c 65 6d 20 | 69 6d 6d 75 74 61 62 6c |ed.{\em |immutabl|
|00000390| 65 7d 2e 20 20 54 68 65 | 20 74 79 70 65 20 64 65 |e}. The| type de|
|000003a0| 74 65 72 6d 69 6e 65 73 | 20 61 6e 20 6f 62 6a 65 |termines| an obje|
|000003b0| 63 74 27 73 20 28 69 6d | 29 6d 75 74 61 62 69 6c |ct's (im|)mutabil|
|000003c0| 69 74 79 2e 0d 5c 69 6e | 64 65 78 7b 69 64 65 6e |ity..\in|dex{iden|
|000003d0| 74 69 74 79 20 6f 66 20 | 61 6e 20 6f 62 6a 65 63 |tity of |an objec|
|000003e0| 74 7d 0d 5c 69 6e 64 65 | 78 7b 76 61 6c 75 65 20 |t}.\inde|x{value |
|000003f0| 6f 66 20 61 6e 20 6f 62 | 6a 65 63 74 7d 0d 5c 69 |of an ob|ject}.\i|
|00000400| 6e 64 65 78 7b 74 79 70 | 65 20 6f 66 20 61 6e 20 |ndex{typ|e of an |
|00000410| 6f 62 6a 65 63 74 7d 0d | 5c 69 6e 64 65 78 7b 6d |object}.|\index{m|
|00000420| 75 74 61 62 6c 65 20 6f | 62 6a 65 63 74 7d 0d 5c |utable o|bject}.\|
|00000430| 69 6e 64 65 78 7b 69 6d | 6d 75 74 61 62 6c 65 20 |index{im|mutable |
|00000440| 6f 62 6a 65 63 74 7d 0d | 0d 4f 62 6a 65 63 74 73 |object}.|.Objects|
|00000450| 20 61 72 65 20 6e 65 76 | 65 72 20 65 78 70 6c 69 | are nev|er expli|
|00000460| 63 69 74 6c 79 20 64 65 | 73 74 72 6f 79 65 64 3b |citly de|stroyed;|
|00000470| 20 68 6f 77 65 76 65 72 | 2c 20 77 68 65 6e 20 74 | however|, when t|
|00000480| 68 65 79 20 62 65 63 6f | 6d 65 0d 75 6e 72 65 61 |hey beco|me.unrea|
|00000490| 63 68 61 62 6c 65 20 74 | 68 65 79 20 6d 61 79 20 |chable t|hey may |
|000004a0| 62 65 20 67 61 72 62 61 | 67 65 2d 63 6f 6c 6c 65 |be garba|ge-colle|
|000004b0| 63 74 65 64 2e 20 20 41 | 6e 20 69 6d 70 6c 65 6d |cted. A|n implem|
|000004c0| 65 6e 74 61 74 69 6f 6e | 20 69 73 0d 61 6c 6c 6f |entation| is.allo|
|000004d0| 77 65 64 20 74 6f 20 64 | 65 6c 61 79 20 67 61 72 |wed to d|elay gar|
|000004e0| 62 61 67 65 20 63 6f 6c | 6c 65 63 74 69 6f 6e 20 |bage col|lection |
|000004f0| 6f 72 20 6f 6d 69 74 20 | 69 74 20 61 6c 74 6f 67 |or omit |it altog|
|00000500| 65 74 68 65 72 20 2d 2d | 2d 20 69 74 20 69 73 20 |ether --|- it is |
|00000510| 61 0d 6d 61 74 74 65 72 | 20 6f 66 20 69 6d 70 6c |a.matter| of impl|
|00000520| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 71 75 61 6c 69 |ementati|on quali|
|00000530| 74 79 20 68 6f 77 20 67 | 61 72 62 61 67 65 20 63 |ty how g|arbage c|
|00000540| 6f 6c 6c 65 63 74 69 6f | 6e 20 69 73 0d 69 6d 70 |ollectio|n is.imp|
|00000550| 6c 65 6d 65 6e 74 65 64 | 2c 20 61 73 20 6c 6f 6e |lemented|, as lon|
|00000560| 67 20 61 73 20 6e 6f 20 | 6f 62 6a 65 63 74 73 20 |g as no |objects |
|00000570| 61 72 65 20 63 6f 6c 6c | 65 63 74 65 64 20 74 68 |are coll|ected th|
|00000580| 61 74 20 61 72 65 20 73 | 74 69 6c 6c 0d 72 65 61 |at are s|till.rea|
|00000590| 63 68 61 62 6c 65 2e 20 | 20 28 49 6d 70 6c 65 6d |chable. | (Implem|
|000005a0| 65 6e 74 61 74 69 6f 6e | 20 6e 6f 74 65 3a 20 74 |entation| note: t|
|000005b0| 68 65 20 63 75 72 72 65 | 6e 74 20 69 6d 70 6c 65 |he curre|nt imple|
|000005c0| 6d 65 6e 74 61 74 69 6f | 6e 20 75 73 65 73 20 61 |mentatio|n uses a|
|000005d0| 0d 72 65 66 65 72 65 6e | 63 65 2d 63 6f 75 6e 74 |.referen|ce-count|
|000005e0| 69 6e 67 20 73 63 68 65 | 6d 65 20 77 68 69 63 68 |ing sche|me which|
|000005f0| 20 63 6f 6c 6c 65 63 74 | 73 20 6d 6f 73 74 20 6f | collect|s most o|
|00000600| 62 6a 65 63 74 73 20 61 | 73 20 73 6f 6f 6e 20 61 |bjects a|s soon a|
|00000610| 73 20 74 68 65 79 0d 62 | 65 63 6f 6d 65 20 75 6e |s they.b|ecome un|
|00000620| 72 65 61 63 68 61 62 6c | 65 2c 20 62 75 74 20 6e |reachabl|e, but n|
|00000630| 65 76 65 72 20 63 6f 6c | 6c 65 63 74 73 20 67 61 |ever col|lects ga|
|00000640| 72 62 61 67 65 20 63 6f | 6e 74 61 69 6e 69 6e 67 |rbage co|ntaining|
|00000650| 20 63 69 72 63 75 6c 61 | 72 0d 72 65 66 65 72 65 | circula|r.refere|
|00000660| 6e 63 65 73 2e 29 0d 5c | 69 6e 64 65 78 7b 67 61 |nces.).\|index{ga|
|00000670| 72 62 61 67 65 20 63 6f | 6c 6c 65 63 74 69 6f 6e |rbage co|llection|
|00000680| 7d 0d 5c 69 6e 64 65 78 | 7b 72 65 66 65 72 65 6e |}.\index|{referen|
|00000690| 63 65 20 63 6f 75 6e 74 | 69 6e 67 7d 0d 5c 69 6e |ce count|ing}.\in|
|000006a0| 64 65 78 7b 75 6e 72 65 | 61 63 68 61 62 6c 65 20 |dex{unre|achable |
|000006b0| 6f 62 6a 65 63 74 7d 0d | 0d 4e 6f 74 65 20 74 68 |object}.|.Note th|
|000006c0| 61 74 20 74 68 65 20 75 | 73 65 20 6f 66 20 74 68 |at the u|se of th|
|000006d0| 65 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |e implem|entation|
|000006e0| 27 73 20 74 72 61 63 69 | 6e 67 20 6f 72 20 64 65 |'s traci|ng or de|
|000006f0| 62 75 67 67 69 6e 67 0d | 66 61 63 69 6c 69 74 69 |bugging.|faciliti|
|00000700| 65 73 20 6d 61 79 20 6b | 65 65 70 20 6f 62 6a 65 |es may k|eep obje|
|00000710| 63 74 73 20 61 6c 69 76 | 65 20 74 68 61 74 20 77 |cts aliv|e that w|
|00000720| 6f 75 6c 64 20 6e 6f 72 | 6d 61 6c 6c 79 20 62 65 |ould nor|mally be|
|00000730| 20 63 6f 6c 6c 65 63 74 | 61 62 6c 65 2e 0d 0d 53 | collect|able...S|
|00000740| 6f 6d 65 20 6f 62 6a 65 | 63 74 73 20 63 6f 6e 74 |ome obje|cts cont|
|00000750| 61 69 6e 20 72 65 66 65 | 72 65 6e 63 65 73 20 74 |ain refe|rences t|
|00000760| 6f 20 60 60 65 78 74 65 | 72 6e 61 6c 27 27 20 72 |o ``exte|rnal'' r|
|00000770| 65 73 6f 75 72 63 65 73 | 20 73 75 63 68 20 61 73 |esources| such as|
|00000780| 20 6f 70 65 6e 0d 66 69 | 6c 65 73 20 6f 72 20 77 | open.fi|les or w|
|00000790| 69 6e 64 6f 77 73 2e 20 | 20 49 74 20 69 73 20 75 |indows. | It is u|
|000007a0| 6e 64 65 72 73 74 6f 6f | 64 20 74 68 61 74 20 74 |nderstoo|d that t|
|000007b0| 68 65 73 65 20 72 65 73 | 6f 75 72 63 65 73 20 61 |hese res|ources a|
|000007c0| 72 65 20 66 72 65 65 64 | 0d 77 68 65 6e 20 74 68 |re freed|.when th|
|000007d0| 65 20 6f 62 6a 65 63 74 | 20 69 73 20 67 61 72 62 |e object| is garb|
|000007e0| 61 67 65 2d 63 6f 6c 6c | 65 63 74 65 64 2c 20 62 |age-coll|ected, b|
|000007f0| 75 74 20 73 69 6e 63 65 | 20 67 61 72 62 61 67 65 |ut since| garbage|
|00000800| 20 63 6f 6c 6c 65 63 74 | 69 6f 6e 20 69 73 0d 6e | collect|ion is.n|
|00000810| 6f 74 20 67 75 61 72 61 | 6e 74 65 65 64 20 74 6f |ot guara|nteed to|
|00000820| 20 68 61 70 70 65 6e 2c | 20 73 75 63 68 20 6f 62 | happen,| such ob|
|00000830| 6a 65 63 74 73 20 61 6c | 73 6f 20 70 72 6f 76 69 |jects al|so provi|
|00000840| 64 65 20 61 6e 20 65 78 | 70 6c 69 63 69 74 20 77 |de an ex|plicit w|
|00000850| 61 79 20 74 6f 0d 72 65 | 6c 65 61 73 65 20 74 68 |ay to.re|lease th|
|00000860| 65 20 65 78 74 65 72 6e | 61 6c 20 72 65 73 6f 75 |e extern|al resou|
|00000870| 72 63 65 2c 20 75 73 75 | 61 6c 6c 79 20 61 20 5c |rce, usu|ally a \|
|00000880| 76 65 72 62 40 63 6c 6f | 73 65 40 20 6d 65 74 68 |verb@clo|se@ meth|
|00000890| 6f 64 2e 0d 50 72 6f 67 | 72 61 6d 73 20 61 72 65 |od..Prog|rams are|
|000008a0| 20 73 74 72 6f 6e 67 6c | 79 20 72 65 63 6f 6d 6d | strongl|y recomm|
|000008b0| 65 6e 64 65 64 20 74 6f | 20 61 6c 77 61 79 73 20 |ended to| always |
|000008c0| 65 78 70 6c 69 63 69 74 | 6c 79 20 63 6c 6f 73 65 |explicit|ly close|
|000008d0| 20 73 75 63 68 0d 6f 62 | 6a 65 63 74 73 2e 0d 0d | such.ob|jects...|
|000008e0| 53 6f 6d 65 20 6f 62 6a | 65 63 74 73 20 63 6f 6e |Some obj|ects con|
|000008f0| 74 61 69 6e 20 72 65 66 | 65 72 65 6e 63 65 73 20 |tain ref|erences |
|00000900| 74 6f 20 6f 74 68 65 72 | 20 6f 62 6a 65 63 74 73 |to other| objects|
|00000910| 3b 20 74 68 65 73 65 20 | 61 72 65 20 63 61 6c 6c |; these |are call|
|00000920| 65 64 0d 7b 5c 65 6d 20 | 63 6f 6e 74 61 69 6e 65 |ed.{\em |containe|
|00000930| 72 73 7d 2e 20 20 45 78 | 61 6d 70 6c 65 73 20 6f |rs}. Ex|amples o|
|00000940| 66 20 63 6f 6e 74 61 69 | 6e 65 72 73 20 61 72 65 |f contai|ners are|
|00000950| 20 74 75 70 6c 65 73 2c | 20 6c 69 73 74 73 20 61 | tuples,| lists a|
|00000960| 6e 64 0d 64 69 63 74 69 | 6f 6e 61 72 69 65 73 2e |nd.dicti|onaries.|
|00000970| 20 20 54 68 65 20 72 65 | 66 65 72 65 6e 63 65 73 | The re|ferences|
|00000980| 20 61 72 65 20 70 61 72 | 74 20 6f 66 20 61 20 63 | are par|t of a c|
|00000990| 6f 6e 74 61 69 6e 65 72 | 27 73 20 76 61 6c 75 65 |ontainer|'s value|
|000009a0| 2e 20 20 49 6e 0d 6d 6f | 73 74 20 63 61 73 65 73 |. In.mo|st cases|
|000009b0| 2c 20 77 68 65 6e 20 77 | 65 20 74 61 6c 6b 20 61 |, when w|e talk a|
|000009c0| 62 6f 75 74 20 74 68 65 | 20 76 61 6c 75 65 20 6f |bout the| value o|
|000009d0| 66 20 61 20 63 6f 6e 74 | 61 69 6e 65 72 2c 20 77 |f a cont|ainer, w|
|000009e0| 65 20 69 6d 70 6c 79 20 | 74 68 65 0d 76 61 6c 75 |e imply |the.valu|
|000009f0| 65 73 2c 20 6e 6f 74 20 | 74 68 65 20 69 64 65 6e |es, not |the iden|
|00000a00| 74 69 74 69 65 73 20 6f | 66 20 74 68 65 20 63 6f |tities o|f the co|
|00000a10| 6e 74 61 69 6e 65 64 20 | 6f 62 6a 65 63 74 73 3b |ntained |objects;|
|00000a20| 20 68 6f 77 65 76 65 72 | 2c 20 77 68 65 6e 20 77 | however|, when w|
|00000a30| 65 0d 74 61 6c 6b 20 61 | 62 6f 75 74 20 74 68 65 |e.talk a|bout the|
|00000a40| 20 28 69 6d 29 6d 75 74 | 61 62 69 6c 69 74 79 20 | (im)mut|ability |
|00000a50| 6f 66 20 61 20 63 6f 6e | 74 61 69 6e 65 72 2c 20 |of a con|tainer, |
|00000a60| 6f 6e 6c 79 20 74 68 65 | 20 69 64 65 6e 74 69 74 |only the| identit|
|00000a70| 69 65 73 20 6f 66 0d 74 | 68 65 20 69 6d 6d 65 64 |ies of.t|he immed|
|00000a80| 69 61 74 65 6c 79 20 63 | 6f 6e 74 61 69 6e 65 64 |iately c|ontained|
|00000a90| 20 6f 62 6a 65 63 74 73 | 20 61 72 65 20 69 6d 70 | objects| are imp|
|00000aa0| 6c 69 65 64 2e 20 20 28 | 53 6f 2c 20 69 66 20 61 |lied. (|So, if a|
|00000ab0| 6e 20 69 6d 6d 75 74 61 | 62 6c 65 0d 63 6f 6e 74 |n immuta|ble.cont|
|00000ac0| 61 69 6e 65 72 20 63 6f | 6e 74 61 69 6e 73 20 61 |ainer co|ntains a|
|00000ad0| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 61 20 | referen|ce to a |
|00000ae0| 6d 75 74 61 62 6c 65 20 | 6f 62 6a 65 63 74 2c 20 |mutable |object, |
|00000af0| 69 74 73 20 76 61 6c 75 | 65 20 63 68 61 6e 67 65 |its valu|e change|
|00000b00| 73 0d 69 66 20 74 68 61 | 74 20 6d 75 74 61 62 6c |s.if tha|t mutabl|
|00000b10| 65 20 6f 62 6a 65 63 74 | 20 69 73 20 63 68 61 6e |e object| is chan|
|00000b20| 67 65 64 2e 29 0d 5c 69 | 6e 64 65 78 7b 63 6f 6e |ged.).\i|ndex{con|
|00000b30| 74 61 69 6e 65 72 7d 0d | 0d 54 79 70 65 73 20 61 |tainer}.|.Types a|
|00000b40| 66 66 65 63 74 20 61 6c | 6d 6f 73 74 20 61 6c 6c |ffect al|most all|
|00000b50| 20 61 73 70 65 63 74 73 | 20 6f 66 20 6f 62 6a 65 | aspects| of obje|
|00000b60| 63 74 73 27 20 6c 69 76 | 65 73 2e 20 20 45 76 65 |cts' liv|es. Eve|
|00000b70| 6e 20 74 68 65 20 6d 65 | 61 6e 69 6e 67 0d 6f 66 |n the me|aning.of|
|00000b80| 20 6f 62 6a 65 63 74 20 | 69 64 65 6e 74 69 74 79 | object |identity|
|00000b90| 20 69 73 20 61 66 66 65 | 63 74 65 64 20 69 6e 20 | is affe|cted in |
|00000ba0| 73 6f 6d 65 20 73 65 6e | 73 65 3a 20 66 6f 72 20 |some sen|se: for |
|00000bb0| 69 6d 6d 75 74 61 62 6c | 65 20 74 79 70 65 73 2c |immutabl|e types,|
|00000bc0| 0d 6f 70 65 72 61 74 69 | 6f 6e 73 20 74 68 61 74 |.operati|ons that|
|00000bd0| 20 63 6f 6d 70 75 74 65 | 20 6e 65 77 20 76 61 6c | compute| new val|
|00000be0| 75 65 73 20 6d 61 79 20 | 61 63 74 75 61 6c 6c 79 |ues may |actually|
|00000bf0| 20 72 65 74 75 72 6e 20 | 61 20 72 65 66 65 72 65 | return |a refere|
|00000c00| 6e 63 65 20 74 6f 0d 61 | 6e 79 20 65 78 69 73 74 |nce to.a|ny exist|
|00000c10| 69 6e 67 20 6f 62 6a 65 | 63 74 20 77 69 74 68 20 |ing obje|ct with |
|00000c20| 74 68 65 20 73 61 6d 65 | 20 74 79 70 65 20 61 6e |the same| type an|
|00000c30| 64 20 76 61 6c 75 65 2c | 20 77 68 69 6c 65 20 66 |d value,| while f|
|00000c40| 6f 72 20 6d 75 74 61 62 | 6c 65 0d 6f 62 6a 65 63 |or mutab|le.objec|
|00000c50| 74 73 20 74 68 69 73 20 | 69 73 20 6e 6f 74 20 61 |ts this |is not a|
|00000c60| 6c 6c 6f 77 65 64 2e 20 | 20 45 2e 67 2e 20 61 66 |llowed. | E.g. af|
|00000c70| 74 65 72 0d 0d 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ter..\be|gin{verb|
|00000c80| 61 74 69 6d 7d 0d 61 20 | 3d 20 31 3b 20 62 20 3d |atim}.a |= 1; b =|
|00000c90| 20 31 3b 20 63 20 3d 20 | 5b 5d 3b 20 64 20 3d 20 | 1; c = |[]; d = |
|00000ca0| 5b 5d 0d 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |[].\end{|verbatim|
|00000cb0| 7d 0d 0d 5c 76 65 72 62 | 40 61 40 20 61 6e 64 20 |}..\verb|@a@ and |
|00000cc0| 5c 76 65 72 62 40 62 40 | 20 6d 61 79 20 6f 72 20 |\verb@b@| may or |
|00000cd0| 6d 61 79 20 6e 6f 74 20 | 72 65 66 65 72 20 74 6f |may not |refer to|
|00000ce0| 20 74 68 65 20 73 61 6d | 65 20 6f 62 6a 65 63 74 | the sam|e object|
|00000cf0| 20 77 69 74 68 20 74 68 | 65 0d 76 61 6c 75 65 20 | with th|e.value |
|00000d00| 6f 6e 65 2c 20 64 65 70 | 65 6e 64 69 6e 67 20 6f |one, dep|ending o|
|00000d10| 6e 20 74 68 65 20 69 6d | 70 6c 65 6d 65 6e 74 61 |n the im|plementa|
|00000d20| 74 69 6f 6e 2c 20 62 75 | 74 20 5c 76 65 72 62 40 |tion, bu|t \verb@|
|00000d30| 63 40 20 61 6e 64 20 5c | 76 65 72 62 40 64 40 0d |c@ and \|verb@d@.|
|00000d40| 61 72 65 20 67 75 61 72 | 61 6e 74 65 65 64 20 74 |are guar|anteed t|
|00000d50| 6f 20 72 65 66 65 72 20 | 74 6f 20 74 77 6f 20 64 |o refer |to two d|
|00000d60| 69 66 66 65 72 65 6e 74 | 2c 20 75 6e 69 71 75 65 |ifferent|, unique|
|00000d70| 2c 20 6e 65 77 6c 79 20 | 63 72 65 61 74 65 64 20 |, newly |created |
|00000d80| 65 6d 70 74 79 0d 6c 69 | 73 74 73 2e 0d 0d 5c 73 |empty.li|sts...\s|
|00000d90| 65 63 74 69 6f 6e 7b 54 | 68 65 20 73 74 61 6e 64 |ection{T|he stand|
|00000da0| 61 72 64 20 74 79 70 65 | 20 68 69 65 72 61 72 63 |ard type| hierarc|
|00000db0| 68 79 7d 20 5c 6c 61 62 | 65 6c 7b 74 79 70 65 73 |hy} \lab|el{types|
|00000dc0| 7d 0d 0d 42 65 6c 6f 77 | 20 69 73 20 61 20 6c 69 |}..Below| is a li|
|00000dd0| 73 74 20 6f 66 20 74 68 | 65 20 74 79 70 65 73 20 |st of th|e types |
|00000de0| 74 68 61 74 20 61 72 65 | 20 62 75 69 6c 74 20 69 |that are| built i|
|00000df0| 6e 74 6f 20 50 79 74 68 | 6f 6e 2e 20 20 45 78 74 |nto Pyth|on. Ext|
|00000e00| 65 6e 73 69 6f 6e 0d 6d | 6f 64 75 6c 65 73 20 77 |ension.m|odules w|
|00000e10| 72 69 74 74 65 6e 20 69 | 6e 20 43 20 63 61 6e 20 |ritten i|n C can |
|00000e20| 64 65 66 69 6e 65 20 61 | 64 64 69 74 69 6f 6e 61 |define a|dditiona|
|00000e30| 6c 20 74 79 70 65 73 2e | 20 20 46 75 74 75 72 65 |l types.| Future|
|00000e40| 20 76 65 72 73 69 6f 6e | 73 20 6f 66 0d 50 79 74 | version|s of.Pyt|
|00000e50| 68 6f 6e 20 6d 61 79 20 | 61 64 64 20 74 79 70 65 |hon may |add type|
|00000e60| 73 20 74 6f 20 74 68 65 | 20 74 79 70 65 20 68 69 |s to the| type hi|
|00000e70| 65 72 61 72 63 68 79 20 | 28 65 2e 67 2e 20 72 61 |erarchy |(e.g. ra|
|00000e80| 74 69 6f 6e 61 6c 20 6f | 72 20 63 6f 6d 70 6c 65 |tional o|r comple|
|00000e90| 78 0d 6e 75 6d 62 65 72 | 73 2c 20 65 66 66 69 63 |x.number|s, effic|
|00000ea0| 69 65 6e 74 6c 79 20 73 | 74 6f 72 65 64 20 61 72 |iently s|tored ar|
|00000eb0| 72 61 79 73 20 6f 66 20 | 69 6e 74 65 67 65 72 73 |rays of |integers|
|00000ec0| 2c 20 65 74 63 2e 29 2e | 0d 5c 69 6e 64 65 78 7b |, etc.).|.\index{|
|00000ed0| 74 79 70 65 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 64 |type}.\i|ndexii{d|
|00000ee0| 61 74 61 7d 7b 74 79 70 | 65 7d 0d 5c 69 6e 64 65 |ata}{typ|e}.\inde|
|00000ef0| 78 69 69 7b 74 79 70 65 | 7d 7b 68 69 65 72 61 72 |xii{type|}{hierar|
|00000f00| 63 68 79 7d 0d 5c 69 6e | 64 65 78 69 69 7b 65 78 |chy}.\in|dexii{ex|
|00000f10| 74 65 6e 73 69 6f 6e 7d | 7b 6d 6f 64 75 6c 65 7d |tension}|{module}|
|00000f20| 0d 5c 69 6e 64 65 78 7b | 43 7d 0d 0d 53 6f 6d 65 |.\index{|C}..Some|
|00000f30| 20 6f 66 20 74 68 65 20 | 74 79 70 65 20 64 65 73 | of the |type des|
|00000f40| 63 72 69 70 74 69 6f 6e | 73 20 62 65 6c 6f 77 20 |cription|s below |
|00000f50| 63 6f 6e 74 61 69 6e 20 | 61 20 70 61 72 61 67 72 |contain |a paragr|
|00000f60| 61 70 68 20 6c 69 73 74 | 69 6e 67 0d 60 73 70 65 |aph list|ing.`spe|
|00000f70| 63 69 61 6c 20 61 74 74 | 72 69 62 75 74 65 73 27 |cial att|ributes'|
|00000f80| 2e 20 20 54 68 65 73 65 | 20 61 72 65 20 61 74 74 |. These| are att|
|00000f90| 72 69 62 75 74 65 73 20 | 74 68 61 74 20 70 72 6f |ributes |that pro|
|00000fa0| 76 69 64 65 20 61 63 63 | 65 73 73 20 74 6f 20 74 |vide acc|ess to t|
|00000fb0| 68 65 0d 69 6d 70 6c 65 | 6d 65 6e 74 61 74 69 6f |he.imple|mentatio|
|00000fc0| 6e 20 61 6e 64 20 61 72 | 65 20 6e 6f 74 20 69 6e |n and ar|e not in|
|00000fd0| 74 65 6e 64 65 64 20 66 | 6f 72 20 67 65 6e 65 72 |tended f|or gener|
|00000fe0| 61 6c 20 75 73 65 2e 20 | 20 54 68 65 69 72 20 64 |al use. | Their d|
|00000ff0| 65 66 69 6e 69 74 69 6f | 6e 0d 6d 61 79 20 63 68 |efinitio|n.may ch|
|00001000| 61 6e 67 65 20 69 6e 20 | 74 68 65 20 66 75 74 75 |ange in |the futu|
|00001010| 72 65 2e 20 20 54 68 65 | 72 65 20 61 72 65 20 61 |re. The|re are a|
|00001020| 6c 73 6f 20 73 6f 6d 65 | 20 60 67 65 6e 65 72 69 |lso some| `generi|
|00001030| 63 27 20 73 70 65 63 69 | 61 6c 0d 61 74 74 72 69 |c' speci|al.attri|
|00001040| 62 75 74 65 73 2c 20 6e | 6f 74 20 6c 69 73 74 65 |butes, n|ot liste|
|00001050| 64 20 77 69 74 68 20 74 | 68 65 20 69 6e 64 69 76 |d with t|he indiv|
|00001060| 69 64 75 61 6c 20 6f 62 | 6a 65 63 74 73 3a 20 5c |idual ob|jects: \|
|00001070| 76 65 72 62 40 5f 5f 6d | 65 74 68 6f 64 73 5f 5f |verb@__m|ethods__|
|00001080| 40 0d 69 73 20 61 20 6c | 69 73 74 20 6f 66 20 74 |@.is a l|ist of t|
|00001090| 68 65 20 6d 65 74 68 6f | 64 20 6e 61 6d 65 73 20 |he metho|d names |
|000010a0| 6f 66 20 61 20 62 75 69 | 6c 74 2d 69 6e 20 6f 62 |of a bui|lt-in ob|
|000010b0| 6a 65 63 74 2c 20 69 66 | 20 69 74 20 68 61 73 20 |ject, if| it has |
|000010c0| 61 6e 79 3b 0d 5c 76 65 | 72 62 40 5f 5f 6d 65 6d |any;.\ve|rb@__mem|
|000010d0| 62 65 72 73 5f 5f 40 20 | 69 73 20 61 20 6c 69 73 |bers__@ |is a lis|
|000010e0| 74 20 6f 66 20 74 68 65 | 20 64 61 74 61 20 61 74 |t of the| data at|
|000010f0| 74 72 69 62 75 74 65 20 | 6e 61 6d 65 73 20 6f 66 |tribute |names of|
|00001100| 20 61 20 62 75 69 6c 74 | 2d 69 6e 0d 6f 62 6a 65 | a built|-in.obje|
|00001110| 63 74 2c 20 69 66 20 69 | 74 20 68 61 73 20 61 6e |ct, if i|t has an|
|00001120| 79 2e 0d 5c 69 6e 64 65 | 78 7b 61 74 74 72 69 62 |y..\inde|x{attrib|
|00001130| 75 74 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 73 70 |ute}.\in|dexii{sp|
|00001140| 65 63 69 61 6c 7d 7b 61 | 74 74 72 69 62 75 74 65 |ecial}{a|ttribute|
|00001150| 7d 0d 5c 69 6e 64 65 78 | 69 69 69 7b 67 65 6e 65 |}.\index|iii{gene|
|00001160| 72 69 63 7d 7b 73 70 65 | 63 69 61 6c 7d 7b 61 74 |ric}{spe|cial}{at|
|00001170| 74 72 69 62 75 74 65 7d | 0d 5c 74 74 69 6e 64 65 |tribute}|.\ttinde|
|00001180| 78 7b 5f 5f 6d 65 74 68 | 6f 64 73 5f 5f 7d 0d 5c |x{__meth|ods__}.\|
|00001190| 74 74 69 6e 64 65 78 7b | 5f 5f 6d 65 6d 62 65 72 |ttindex{|__member|
|000011a0| 73 5f 5f 7d 0d 0d 5c 62 | 65 67 69 6e 7b 64 65 73 |s__}..\b|egin{des|
|000011b0| 63 72 69 70 74 69 6f 6e | 7d 0d 0d 5c 69 74 65 6d |cription|}..\item|
|000011c0| 5b 4e 6f 6e 65 5d 0d 54 | 68 69 73 20 74 79 70 65 |[None].T|his type|
|000011d0| 20 68 61 73 20 61 20 73 | 69 6e 67 6c 65 20 76 61 | has a s|ingle va|
|000011e0| 6c 75 65 2e 20 20 54 68 | 65 72 65 20 69 73 20 61 |lue. Th|ere is a|
|000011f0| 20 73 69 6e 67 6c 65 20 | 6f 62 6a 65 63 74 20 77 | single |object w|
|00001200| 69 74 68 20 74 68 69 73 | 20 76 61 6c 75 65 2e 0d |ith this| value..|
|00001210| 54 68 69 73 20 6f 62 6a | 65 63 74 20 69 73 20 61 |This obj|ect is a|
|00001220| 63 63 65 73 73 65 64 20 | 74 68 72 6f 75 67 68 20 |ccessed |through |
|00001230| 74 68 65 20 62 75 69 6c | 74 2d 69 6e 20 6e 61 6d |the buil|t-in nam|
|00001240| 65 20 5c 76 65 72 62 40 | 4e 6f 6e 65 40 2e 0d 49 |e \verb@|None@..I|
|00001250| 74 20 69 73 20 72 65 74 | 75 72 6e 65 64 20 66 72 |t is ret|urned fr|
|00001260| 6f 6d 20 66 75 6e 63 74 | 69 6f 6e 73 20 74 68 61 |om funct|ions tha|
|00001270| 74 20 64 6f 6e 27 74 20 | 65 78 70 6c 69 63 69 74 |t don't |explicit|
|00001280| 6c 79 20 72 65 74 75 72 | 6e 20 61 6e 20 6f 62 6a |ly retur|n an obj|
|00001290| 65 63 74 2e 0d 5c 74 74 | 69 6e 64 65 78 7b 4e 6f |ect..\tt|index{No|
|000012a0| 6e 65 7d 0d 5c 6f 62 69 | 6e 64 65 78 7b 4e 6f 6e |ne}.\obi|ndex{Non|
|000012b0| 65 40 7b 5c 74 74 20 4e | 6f 6e 65 7d 7d 0d 0d 5c |e@{\tt N|one}}..\|
|000012c0| 69 74 65 6d 5b 4e 75 6d | 62 65 72 73 5d 0d 54 68 |item[Num|bers].Th|
|000012d0| 65 73 65 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |ese are |created |
|000012e0| 62 79 20 6e 75 6d 65 72 | 69 63 20 6c 69 74 65 72 |by numer|ic liter|
|000012f0| 61 6c 73 20 61 6e 64 20 | 72 65 74 75 72 6e 65 64 |als and |returned|
|00001300| 20 61 73 20 72 65 73 75 | 6c 74 73 20 62 79 0d 61 | as resu|lts by.a|
|00001310| 72 69 74 68 6d 65 74 69 | 63 20 6f 70 65 72 61 74 |rithmeti|c operat|
|00001320| 6f 72 73 20 61 6e 64 20 | 61 72 69 74 68 6d 65 74 |ors and |arithmet|
|00001330| 69 63 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 |ic built|-in func|
|00001340| 74 69 6f 6e 73 2e 20 20 | 4e 75 6d 65 72 69 63 0d |tions. |Numeric.|
|00001350| 6f 62 6a 65 63 74 73 20 | 61 72 65 20 69 6d 6d 75 |objects |are immu|
|00001360| 74 61 62 6c 65 3b 20 6f | 6e 63 65 20 63 72 65 61 |table; o|nce crea|
|00001370| 74 65 64 20 74 68 65 69 | 72 20 76 61 6c 75 65 20 |ted thei|r value |
|00001380| 6e 65 76 65 72 20 63 68 | 61 6e 67 65 73 2e 20 20 |never ch|anges. |
|00001390| 50 79 74 68 6f 6e 0d 6e | 75 6d 62 65 72 73 20 61 |Python.n|umbers a|
|000013a0| 72 65 20 6f 66 20 63 6f | 75 72 73 65 20 73 74 72 |re of co|urse str|
|000013b0| 6f 6e 67 6c 79 20 72 65 | 6c 61 74 65 64 20 74 6f |ongly re|lated to|
|000013c0| 20 6d 61 74 68 65 6d 61 | 74 69 63 61 6c 20 6e 75 | mathema|tical nu|
|000013d0| 6d 62 65 72 73 2c 20 62 | 75 74 0d 73 75 62 6a 65 |mbers, b|ut.subje|
|000013e0| 63 74 20 74 6f 20 74 68 | 65 20 6c 69 6d 69 74 61 |ct to th|e limita|
|000013f0| 74 69 6f 6e 73 20 6f 66 | 20 6e 75 6d 65 72 69 63 |tions of| numeric|
|00001400| 61 6c 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |al repre|sentatio|
|00001410| 6e 20 69 6e 20 63 6f 6d | 70 75 74 65 72 73 2e 0d |n in com|puters..|
|00001420| 5c 6f 62 69 6e 64 65 78 | 7b 6e 75 6d 62 65 72 7d |\obindex|{number}|
|00001430| 0d 5c 6f 62 69 6e 64 65 | 78 7b 6e 75 6d 65 72 69 |.\obinde|x{numeri|
|00001440| 63 7d 0d 0d 50 79 74 68 | 6f 6e 20 64 69 73 74 69 |c}..Pyth|on disti|
|00001450| 6e 67 75 69 73 68 65 73 | 20 62 65 74 77 65 65 6e |nguishes| between|
|00001460| 20 69 6e 74 65 67 65 72 | 73 20 61 6e 64 20 66 6c | integer|s and fl|
|00001470| 6f 61 74 69 6e 67 20 70 | 6f 69 6e 74 20 6e 75 6d |oating p|oint num|
|00001480| 62 65 72 73 3a 0d 0d 5c | 62 65 67 69 6e 7b 64 65 |bers:..\|begin{de|
|00001490| 73 63 72 69 70 74 69 6f | 6e 7d 0d 5c 69 74 65 6d |scriptio|n}.\item|
|000014a0| 5b 49 6e 74 65 67 65 72 | 73 5d 0d 54 68 65 73 65 |[Integer|s].These|
|000014b0| 20 72 65 70 72 65 73 65 | 6e 74 20 65 6c 65 6d 65 | represe|nt eleme|
|000014c0| 6e 74 73 20 66 72 6f 6d | 20 74 68 65 20 6d 61 74 |nts from| the mat|
|000014d0| 68 65 6d 61 74 69 63 61 | 6c 20 73 65 74 20 6f 66 |hematica|l set of|
|000014e0| 20 77 68 6f 6c 65 20 6e | 75 6d 62 65 72 73 2e 0d | whole n|umbers..|
|000014f0| 5c 6f 62 69 6e 64 65 78 | 7b 69 6e 74 65 67 65 72 |\obindex|{integer|
|00001500| 7d 0d 0d 54 68 65 72 65 | 20 61 72 65 20 74 77 6f |}..There| are two|
|00001510| 20 74 79 70 65 73 20 6f | 66 20 69 6e 74 65 67 65 | types o|f intege|
|00001520| 72 73 3a 0d 0d 5c 62 65 | 67 69 6e 7b 64 65 73 63 |rs:..\be|gin{desc|
|00001530| 72 69 70 74 69 6f 6e 7d | 0d 0d 5c 69 74 65 6d 5b |ription}|..\item[|
|00001540| 50 6c 61 69 6e 20 69 6e | 74 65 67 65 72 73 5d 0d |Plain in|tegers].|
|00001550| 54 68 65 73 65 20 72 65 | 70 72 65 73 65 6e 74 20 |These re|present |
|00001560| 6e 75 6d 62 65 72 73 20 | 69 6e 20 74 68 65 20 72 |numbers |in the r|
|00001570| 61 6e 67 65 20 2d 32 31 | 34 37 34 38 33 36 34 38 |ange -21|47483648|
|00001580| 20 74 68 72 6f 75 67 68 | 20 32 31 34 37 34 38 33 | through| 2147483|
|00001590| 36 34 37 2e 0d 28 54 68 | 65 20 72 61 6e 67 65 20 |647..(Th|e range |
|000015a0| 6d 61 79 20 62 65 20 6c | 61 72 67 65 72 20 6f 6e |may be l|arger on|
|000015b0| 20 6d 61 63 68 69 6e 65 | 73 20 77 69 74 68 20 61 | machine|s with a|
|000015c0| 20 6c 61 72 67 65 72 20 | 6e 61 74 75 72 61 6c 20 | larger |natural |
|000015d0| 77 6f 72 64 0d 73 69 7a | 65 2c 20 62 75 74 20 6e |word.siz|e, but n|
|000015e0| 6f 74 20 73 6d 61 6c 6c | 65 72 2e 29 0d 57 68 65 |ot small|er.).Whe|
|000015f0| 6e 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |n the re|sult of |
|00001600| 61 6e 20 6f 70 65 72 61 | 74 69 6f 6e 20 66 61 6c |an opera|tion fal|
|00001610| 6c 73 20 6f 75 74 73 69 | 64 65 20 74 68 69 73 20 |ls outsi|de this |
|00001620| 72 61 6e 67 65 2c 20 74 | 68 65 0d 65 78 63 65 70 |range, t|he.excep|
|00001630| 74 69 6f 6e 20 5c 76 65 | 72 62 40 4f 76 65 72 66 |tion \ve|rb@Overf|
|00001640| 6c 6f 77 45 72 72 6f 72 | 40 20 69 73 20 72 61 69 |lowError|@ is rai|
|00001650| 73 65 64 2e 0d 46 6f 72 | 20 74 68 65 20 70 75 72 |sed..For| the pur|
|00001660| 70 6f 73 65 20 6f 66 20 | 73 68 69 66 74 20 61 6e |pose of |shift an|
|00001670| 64 20 6d 61 73 6b 20 6f | 70 65 72 61 74 69 6f 6e |d mask o|peration|
|00001680| 73 2c 20 69 6e 74 65 67 | 65 72 73 20 61 72 65 20 |s, integ|ers are |
|00001690| 61 73 73 75 6d 65 64 20 | 74 6f 0d 68 61 76 65 20 |assumed |to.have |
|000016a0| 61 20 62 69 6e 61 72 79 | 2c 20 32 27 73 20 63 6f |a binary|, 2's co|
|000016b0| 6d 70 6c 65 6d 65 6e 74 | 20 6e 6f 74 61 74 69 6f |mplement| notatio|
|000016c0| 6e 20 75 73 69 6e 67 20 | 33 32 20 6f 72 20 6d 6f |n using |32 or mo|
|000016d0| 72 65 20 62 69 74 73 2c | 20 61 6e 64 0d 68 69 64 |re bits,| and.hid|
|000016e0| 69 6e 67 20 6e 6f 20 62 | 69 74 73 20 66 72 6f 6d |ing no b|its from|
|000016f0| 20 74 68 65 20 75 73 65 | 72 20 28 69 2e 65 2e 2c | the use|r (i.e.,|
|00001700| 20 61 6c 6c 20 34 32 39 | 34 39 36 37 32 39 36 20 | all 429|4967296 |
|00001710| 64 69 66 66 65 72 65 6e | 74 20 62 69 74 0d 70 61 |differen|t bit.pa|
|00001720| 74 74 65 72 6e 73 20 63 | 6f 72 72 65 73 70 6f 6e |tterns c|orrespon|
|00001730| 64 20 74 6f 20 64 69 66 | 66 65 72 65 6e 74 20 76 |d to dif|ferent v|
|00001740| 61 6c 75 65 73 29 2e 0d | 5c 6f 62 69 6e 64 65 78 |alues)..|\obindex|
|00001750| 7b 70 6c 61 69 6e 20 69 | 6e 74 65 67 65 72 7d 0d |{plain i|nteger}.|
|00001760| 0d 5c 69 74 65 6d 5b 4c | 6f 6e 67 20 69 6e 74 65 |.\item[L|ong inte|
|00001770| 67 65 72 73 5d 0d 54 68 | 65 73 65 20 72 65 70 72 |gers].Th|ese repr|
|00001780| 65 73 65 6e 74 20 6e 75 | 6d 62 65 72 73 20 69 6e |esent nu|mbers in|
|00001790| 20 61 6e 20 75 6e 6c 69 | 6d 69 74 65 64 20 72 61 | an unli|mited ra|
|000017a0| 6e 67 65 2c 20 73 75 62 | 6a 65 63 74 20 74 6f 20 |nge, sub|ject to |
|000017b0| 61 76 61 69 6c 61 62 6c | 65 0d 28 76 69 72 74 75 |availabl|e.(virtu|
|000017c0| 61 6c 29 20 6d 65 6d 6f | 72 79 20 6f 6e 6c 79 2e |al) memo|ry only.|
|000017d0| 20 20 46 6f 72 20 74 68 | 65 20 70 75 72 70 6f 73 | For th|e purpos|
|000017e0| 65 20 6f 66 20 73 68 69 | 66 74 20 61 6e 64 20 6d |e of shi|ft and m|
|000017f0| 61 73 6b 20 6f 70 65 72 | 61 74 69 6f 6e 73 2c 0d |ask oper|ations,.|
|00001800| 61 20 62 69 6e 61 72 79 | 20 72 65 70 72 65 73 65 |a binary| represe|
|00001810| 6e 74 61 74 69 6f 6e 20 | 69 73 20 61 73 73 75 6d |ntation |is assum|
|00001820| 65 64 2c 20 61 6e 64 20 | 6e 65 67 61 74 69 76 65 |ed, and |negative|
|00001830| 20 6e 75 6d 62 65 72 73 | 20 61 72 65 0d 72 65 70 | numbers| are.rep|
|00001840| 72 65 73 65 6e 74 65 64 | 20 69 6e 20 61 20 76 61 |resented| in a va|
|00001850| 72 69 61 6e 74 20 6f 66 | 20 32 27 73 20 63 6f 6d |riant of| 2's com|
|00001860| 70 6c 65 6d 65 6e 74 20 | 77 68 69 63 68 20 67 69 |plement |which gi|
|00001870| 76 65 73 20 74 68 65 20 | 69 6c 6c 75 73 69 6f 6e |ves the |illusion|
|00001880| 20 6f 66 0d 61 6e 20 69 | 6e 66 69 6e 69 74 65 20 | of.an i|nfinite |
|00001890| 73 74 72 69 6e 67 20 6f | 66 20 73 69 67 6e 20 62 |string o|f sign b|
|000018a0| 69 74 73 20 65 78 74 65 | 6e 64 69 6e 67 20 74 6f |its exte|nding to|
|000018b0| 20 74 68 65 20 6c 65 66 | 74 2e 0d 5c 6f 62 69 6e | the lef|t..\obin|
|000018c0| 64 65 78 7b 6c 6f 6e 67 | 20 69 6e 74 65 67 65 72 |dex{long| integer|
|000018d0| 7d 0d 0d 5c 65 6e 64 7b | 64 65 73 63 72 69 70 74 |}..\end{|descript|
|000018e0| 69 6f 6e 7d 20 25 20 49 | 6e 74 65 67 65 72 73 0d |ion} % I|ntegers.|
|000018f0| 0d 54 68 65 20 72 75 6c | 65 73 20 66 6f 72 20 69 |.The rul|es for i|
|00001900| 6e 74 65 67 65 72 20 72 | 65 70 72 65 73 65 6e 74 |nteger r|epresent|
|00001910| 61 74 69 6f 6e 20 61 72 | 65 20 69 6e 74 65 6e 64 |ation ar|e intend|
|00001920| 65 64 20 74 6f 20 67 69 | 76 65 20 74 68 65 20 6d |ed to gi|ve the m|
|00001930| 6f 73 74 0d 6d 65 61 6e | 69 6e 67 66 75 6c 20 69 |ost.mean|ingful i|
|00001940| 6e 74 65 72 70 72 65 74 | 61 74 69 6f 6e 20 6f 66 |nterpret|ation of|
|00001950| 20 73 68 69 66 74 20 61 | 6e 64 20 6d 61 73 6b 20 | shift a|nd mask |
|00001960| 6f 70 65 72 61 74 69 6f | 6e 73 20 69 6e 76 6f 6c |operatio|ns invol|
|00001970| 76 69 6e 67 0d 6e 65 67 | 61 74 69 76 65 20 69 6e |ving.neg|ative in|
|00001980| 74 65 67 65 72 73 20 61 | 6e 64 20 74 68 65 20 6c |tegers a|nd the l|
|00001990| 65 61 73 74 20 73 75 72 | 70 72 69 73 65 73 20 77 |east sur|prises w|
|000019a0| 68 65 6e 20 73 77 69 74 | 63 68 69 6e 67 20 62 65 |hen swit|ching be|
|000019b0| 74 77 65 65 6e 20 74 68 | 65 0d 70 6c 61 69 6e 20 |tween th|e.plain |
|000019c0| 61 6e 64 20 6c 6f 6e 67 | 20 69 6e 74 65 67 65 72 |and long| integer|
|000019d0| 20 64 6f 6d 61 69 6e 73 | 2e 20 20 46 6f 72 20 61 | domains|. For a|
|000019e0| 6e 79 20 6f 70 65 72 61 | 74 69 6f 6e 20 65 78 63 |ny opera|tion exc|
|000019f0| 65 70 74 20 6c 65 66 74 | 20 73 68 69 66 74 2c 0d |ept left| shift,.|
|00001a00| 69 66 20 69 74 20 79 69 | 65 6c 64 73 20 61 20 72 |if it yi|elds a r|
|00001a10| 65 73 75 6c 74 20 69 6e | 20 74 68 65 20 70 6c 61 |esult in| the pla|
|00001a20| 69 6e 20 69 6e 74 65 67 | 65 72 20 64 6f 6d 61 69 |in integ|er domai|
|00001a30| 6e 20 77 69 74 68 6f 75 | 74 20 63 61 75 73 69 6e |n withou|t causin|
|00001a40| 67 0d 6f 76 65 72 66 6c | 6f 77 2c 20 69 74 20 77 |g.overfl|ow, it w|
|00001a50| 69 6c 6c 20 79 69 65 6c | 64 20 74 68 65 20 73 61 |ill yiel|d the sa|
|00001a60| 6d 65 20 72 65 73 75 6c | 74 20 69 6e 20 74 68 65 |me resul|t in the|
|00001a70| 20 6c 6f 6e 67 20 69 6e | 74 65 67 65 72 20 64 6f | long in|teger do|
|00001a80| 6d 61 69 6e 20 6f 72 0d | 77 68 65 6e 20 75 73 69 |main or.|when usi|
|00001a90| 6e 67 20 6d 69 78 65 64 | 20 6f 70 65 72 61 6e 64 |ng mixed| operand|
|00001aa0| 73 2e 0d 5c 69 6e 64 65 | 78 69 69 7b 69 6e 74 65 |s..\inde|xii{inte|
|00001ab0| 67 65 72 7d 7b 72 65 70 | 72 65 73 65 6e 74 61 74 |ger}{rep|resentat|
|00001ac0| 69 6f 6e 7d 0d 0d 5c 69 | 74 65 6d 5b 46 6c 6f 61 |ion}..\i|tem[Floa|
|00001ad0| 74 69 6e 67 20 70 6f 69 | 6e 74 20 6e 75 6d 62 65 |ting poi|nt numbe|
|00001ae0| 72 73 5d 0d 54 68 65 73 | 65 20 72 65 70 72 65 73 |rs].Thes|e repres|
|00001af0| 65 6e 74 20 6d 61 63 68 | 69 6e 65 2d 6c 65 76 65 |ent mach|ine-leve|
|00001b00| 6c 20 64 6f 75 62 6c 65 | 20 70 72 65 63 69 73 69 |l double| precisi|
|00001b10| 6f 6e 20 66 6c 6f 61 74 | 69 6e 67 20 70 6f 69 6e |on float|ing poin|
|00001b20| 74 20 6e 75 6d 62 65 72 | 73 2e 20 20 0d 59 6f 75 |t number|s. .You|
|00001b30| 20 61 72 65 20 61 74 20 | 74 68 65 20 6d 65 72 63 | are at |the merc|
|00001b40| 79 20 6f 66 20 74 68 65 | 20 75 6e 64 65 72 6c 79 |y of the| underly|
|00001b50| 69 6e 67 20 6d 61 63 68 | 69 6e 65 20 61 72 63 68 |ing mach|ine arch|
|00001b60| 69 74 65 63 74 75 72 65 | 20 61 6e 64 0d 43 20 69 |itecture| and.C i|
|00001b70| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 20 66 6f |mplement|ation fo|
|00001b80| 72 20 74 68 65 20 61 63 | 63 65 70 74 65 64 20 72 |r the ac|cepted r|
|00001b90| 61 6e 67 65 20 61 6e 64 | 20 68 61 6e 64 6c 69 6e |ange and| handlin|
|00001ba0| 67 20 6f 66 20 6f 76 65 | 72 66 6c 6f 77 2e 0d 5c |g of ove|rflow..\|
|00001bb0| 6f 62 69 6e 64 65 78 7b | 66 6c 6f 61 74 69 6e 67 |obindex{|floating|
|00001bc0| 20 70 6f 69 6e 74 7d 0d | 5c 69 6e 64 65 78 69 69 | point}.|\indexii|
|00001bd0| 7b 66 6c 6f 61 74 69 6e | 67 20 70 6f 69 6e 74 7d |{floatin|g point}|
|00001be0| 7b 6e 75 6d 62 65 72 7d | 0d 5c 69 6e 64 65 78 7b |{number}|.\index{|
|00001bf0| 43 7d 0d 0d 5c 65 6e 64 | 7b 64 65 73 63 72 69 70 |C}..\end|{descrip|
|00001c00| 74 69 6f 6e 7d 20 25 20 | 4e 75 6d 62 65 72 73 0d |tion} % |Numbers.|
|00001c10| 0d 5c 69 74 65 6d 5b 53 | 65 71 75 65 6e 63 65 73 |.\item[S|equences|
|00001c20| 5d 0d 54 68 65 73 65 20 | 72 65 70 72 65 73 65 6e |].These |represen|
|00001c30| 74 20 66 69 6e 69 74 65 | 20 6f 72 64 65 72 65 64 |t finite| ordered|
|00001c40| 20 73 65 74 73 20 69 6e | 64 65 78 65 64 20 62 79 | sets in|dexed by|
|00001c50| 20 6e 61 74 75 72 61 6c | 20 6e 75 6d 62 65 72 73 | natural| numbers|
|00001c60| 2e 0d 54 68 65 20 62 75 | 69 6c 74 2d 69 6e 20 66 |..The bu|ilt-in f|
|00001c70| 75 6e 63 74 69 6f 6e 20 | 5c 76 65 72 62 40 6c 65 |unction |\verb@le|
|00001c80| 6e 28 29 40 20 72 65 74 | 75 72 6e 73 20 74 68 65 |n()@ ret|urns the|
|00001c90| 20 6e 75 6d 62 65 72 20 | 6f 66 20 65 6c 65 6d 65 | number |of eleme|
|00001ca0| 6e 74 73 0d 6f 66 20 61 | 20 73 65 71 75 65 6e 63 |nts.of a| sequenc|
|00001cb0| 65 2e 20 20 57 68 65 6e | 20 74 68 69 73 20 6e 75 |e. When| this nu|
|00001cc0| 6d 62 65 72 20 69 73 20 | 5c 76 61 72 7b 6e 7d 2c |mber is |\var{n},|
|00001cd0| 20 74 68 65 20 69 6e 64 | 65 78 20 73 65 74 20 63 | the ind|ex set c|
|00001ce0| 6f 6e 74 61 69 6e 73 0d | 74 68 65 20 6e 75 6d 62 |ontains.|the numb|
|00001cf0| 65 72 73 20 30 2c 20 31 | 2c 20 5c 6c 64 6f 74 73 |ers 0, 1|, \ldots|
|00001d00| 2c 20 5c 76 61 72 7b 6e | 7d 2d 31 2e 20 20 45 6c |, \var{n|}-1. El|
|00001d10| 65 6d 65 6e 74 20 5c 76 | 61 72 7b 69 7d 20 6f 66 |ement \v|ar{i} of|
|00001d20| 20 73 65 71 75 65 6e 63 | 65 0d 5c 76 61 72 7b 61 | sequenc|e.\var{a|
|00001d30| 7d 20 69 73 20 73 65 6c | 65 63 74 65 64 20 62 79 |} is sel|ected by|
|00001d40| 20 5c 63 6f 64 65 7b 5c | 76 61 72 7b 61 7d 5b 5c | \code{\|var{a}[\|
|00001d50| 76 61 72 7b 69 7d 5d 7d | 2e 0d 5c 6f 62 69 6e 64 |var{i}]}|..\obind|
|00001d60| 65 78 7b 73 65 71 65 6e | 63 65 7d 0d 5c 62 69 66 |ex{seqen|ce}.\bif|
|00001d70| 75 6e 63 69 6e 64 65 78 | 7b 6c 65 6e 7d 0d 5c 69 |uncindex|{len}.\i|
|00001d80| 6e 64 65 78 7b 69 6e 64 | 65 78 20 6f 70 65 72 61 |ndex{ind|ex opera|
|00001d90| 74 69 6f 6e 7d 0d 5c 69 | 6e 64 65 78 7b 69 74 65 |tion}.\i|ndex{ite|
|00001da0| 6d 20 73 65 6c 65 63 74 | 69 6f 6e 7d 0d 5c 69 6e |m select|ion}.\in|
|00001db0| 64 65 78 7b 73 75 62 73 | 63 72 69 70 74 69 6f 6e |dex{subs|cription|
|00001dc0| 7d 0d 0d 53 65 71 75 65 | 6e 63 65 73 20 61 6c 73 |}..Seque|nces als|
|00001dd0| 6f 20 73 75 70 70 6f 72 | 74 20 73 6c 69 63 69 6e |o suppor|t slicin|
|00001de0| 67 3a 20 5c 76 65 72 62 | 40 61 5b 69 3a 6a 5d 40 |g: \verb|@a[i:j]@|
|00001df0| 20 73 65 6c 65 63 74 73 | 20 61 6c 6c 20 65 6c 65 | selects| all ele|
|00001e00| 6d 65 6e 74 73 0d 77 69 | 74 68 20 69 6e 64 65 78 |ments.wi|th index|
|00001e10| 20 5c 76 61 72 7b 6b 7d | 20 73 75 63 68 20 74 68 | \var{k}| such th|
|00001e20| 61 74 20 5c 76 61 72 7b | 69 7d 20 5c 63 6f 64 65 |at \var{|i} \code|
|00001e30| 7b 3c 3d 7d 20 5c 76 61 | 72 7b 6b 7d 20 5c 63 6f |{<=} \va|r{k} \co|
|00001e40| 64 65 7b 3c 7d 0d 5c 76 | 61 72 7b 6a 7d 2e 20 20 |de{<}.\v|ar{j}. |
|00001e50| 57 68 65 6e 20 75 73 65 | 64 20 61 73 20 61 6e 20 |When use|d as an |
|00001e60| 65 78 70 72 65 73 73 69 | 6f 6e 2c 20 61 20 73 6c |expressi|on, a sl|
|00001e70| 69 63 65 20 69 73 20 61 | 20 73 65 71 75 65 6e 63 |ice is a| sequenc|
|00001e80| 65 20 6f 66 20 74 68 65 | 0d 73 61 6d 65 20 74 79 |e of the|.same ty|
|00001e90| 70 65 20 2d 2d 2d 20 74 | 68 69 73 20 69 6d 70 6c |pe --- t|his impl|
|00001ea0| 69 65 73 20 74 68 61 74 | 20 74 68 65 20 69 6e 64 |ies that| the ind|
|00001eb0| 65 78 20 73 65 74 20 69 | 73 20 72 65 6e 75 6d 62 |ex set i|s renumb|
|00001ec0| 65 72 65 64 20 73 6f 20 | 74 68 61 74 20 69 74 0d |ered so |that it.|
|00001ed0| 73 74 61 72 74 73 20 61 | 74 20 30 20 61 67 61 69 |starts a|t 0 agai|
|00001ee0| 6e 2e 0d 5c 69 6e 64 65 | 78 7b 73 6c 69 63 69 6e |n..\inde|x{slicin|
|00001ef0| 67 7d 0d 0d 53 65 71 75 | 65 6e 63 65 73 20 61 72 |g}..Sequ|ences ar|
|00001f00| 65 20 64 69 73 74 69 6e | 67 75 69 73 68 65 64 20 |e distin|guished |
|00001f10| 61 63 63 6f 72 64 69 6e | 67 20 74 6f 20 74 68 65 |accordin|g to the|
|00001f20| 69 72 20 6d 75 74 61 62 | 69 6c 69 74 79 3a 0d 0d |ir mutab|ility:..|
|00001f30| 5c 62 65 67 69 6e 7b 64 | 65 73 63 72 69 70 74 69 |\begin{d|escripti|
|00001f40| 6f 6e 7d 0d 25 0d 5c 69 | 74 65 6d 5b 49 6d 6d 75 |on}.%.\i|tem[Immu|
|00001f50| 74 61 62 6c 65 20 73 65 | 71 75 65 6e 63 65 73 5d |table se|quences]|
|00001f60| 0d 41 6e 20 6f 62 6a 65 | 63 74 20 6f 66 20 61 6e |.An obje|ct of an|
|00001f70| 20 69 6d 6d 75 74 61 62 | 6c 65 20 73 65 71 75 65 | immutab|le seque|
|00001f80| 6e 63 65 20 74 79 70 65 | 20 63 61 6e 6e 6f 74 20 |nce type| cannot |
|00001f90| 63 68 61 6e 67 65 20 6f | 6e 63 65 20 69 74 20 69 |change o|nce it i|
|00001fa0| 73 0d 63 72 65 61 74 65 | 64 2e 20 20 28 49 66 20 |s.create|d. (If |
|00001fb0| 74 68 65 20 6f 62 6a 65 | 63 74 20 63 6f 6e 74 61 |the obje|ct conta|
|00001fc0| 69 6e 73 20 72 65 66 65 | 72 65 6e 63 65 73 20 74 |ins refe|rences t|
|00001fd0| 6f 20 6f 74 68 65 72 20 | 6f 62 6a 65 63 74 73 2c |o other |objects,|
|00001fe0| 0d 74 68 65 73 65 20 6f | 74 68 65 72 20 6f 62 6a |.these o|ther obj|
|00001ff0| 65 63 74 73 20 6d 61 79 | 20 62 65 20 6d 75 74 61 |ects may| be muta|
|00002000| 62 6c 65 20 61 6e 64 20 | 6d 61 79 20 62 65 20 63 |ble and |may be c|
|00002010| 68 61 6e 67 65 64 3b 20 | 68 6f 77 65 76 65 72 0d |hanged; |however.|
|00002020| 74 68 65 20 63 6f 6c 6c | 65 63 74 69 6f 6e 20 6f |the coll|ection o|
|00002030| 66 20 6f 62 6a 65 63 74 | 73 20 64 69 72 65 63 74 |f object|s direct|
|00002040| 6c 79 20 72 65 66 65 72 | 65 6e 63 65 64 20 62 79 |ly refer|enced by|
|00002050| 20 61 6e 20 69 6d 6d 75 | 74 61 62 6c 65 20 6f 62 | an immu|table ob|
|00002060| 6a 65 63 74 0d 63 61 6e | 6e 6f 74 20 63 68 61 6e |ject.can|not chan|
|00002070| 67 65 2e 29 0d 5c 6f 62 | 69 6e 64 65 78 7b 69 6d |ge.).\ob|index{im|
|00002080| 6d 75 74 61 62 6c 65 20 | 73 65 71 75 65 6e 63 65 |mutable |sequence|
|00002090| 7d 0d 5c 6f 62 69 6e 64 | 65 78 7b 69 6d 6d 75 74 |}.\obind|ex{immut|
|000020a0| 61 62 6c 65 7d 0d 0d 54 | 68 65 20 66 6f 6c 6c 6f |able}..T|he follo|
|000020b0| 77 69 6e 67 20 74 79 70 | 65 73 20 61 72 65 20 69 |wing typ|es are i|
|000020c0| 6d 6d 75 74 61 62 6c 65 | 20 73 65 71 75 65 6e 63 |mmutable| sequenc|
|000020d0| 65 73 3a 0d 0d 5c 62 65 | 67 69 6e 7b 64 65 73 63 |es:..\be|gin{desc|
|000020e0| 72 69 70 74 69 6f 6e 7d | 0d 0d 5c 69 74 65 6d 5b |ription}|..\item[|
|000020f0| 53 74 72 69 6e 67 73 5d | 0d 54 68 65 20 65 6c 65 |Strings]|.The ele|
|00002100| 6d 65 6e 74 73 20 6f 66 | 20 61 20 73 74 72 69 6e |ments of| a strin|
|00002110| 67 20 61 72 65 20 63 68 | 61 72 61 63 74 65 72 73 |g are ch|aracters|
|00002120| 2e 20 20 54 68 65 72 65 | 20 69 73 20 6e 6f 20 73 |. There| is no s|
|00002130| 65 70 61 72 61 74 65 0d | 63 68 61 72 61 63 74 65 |eparate.|characte|
|00002140| 72 20 74 79 70 65 3b 20 | 61 20 63 68 61 72 61 63 |r type; |a charac|
|00002150| 74 65 72 20 69 73 20 72 | 65 70 72 65 73 65 6e 74 |ter is r|epresent|
|00002160| 65 64 20 62 79 20 61 20 | 73 74 72 69 6e 67 20 6f |ed by a |string o|
|00002170| 66 20 6f 6e 65 20 65 6c | 65 6d 65 6e 74 2e 0d 43 |f one el|ement..C|
|00002180| 68 61 72 61 63 74 65 72 | 73 20 72 65 70 72 65 73 |haracter|s repres|
|00002190| 65 6e 74 20 28 61 74 20 | 6c 65 61 73 74 29 20 38 |ent (at |least) 8|
|000021a0| 2d 62 69 74 20 62 79 74 | 65 73 2e 20 20 54 68 65 |-bit byt|es. The|
|000021b0| 20 62 75 69 6c 74 2d 69 | 6e 0d 66 75 6e 63 74 69 | built-i|n.functi|
|000021c0| 6f 6e 73 20 5c 76 65 72 | 62 40 63 68 72 28 29 40 |ons \ver|b@chr()@|
|000021d0| 20 61 6e 64 20 5c 76 65 | 72 62 40 6f 72 64 28 29 | and \ve|rb@ord()|
|000021e0| 40 20 63 6f 6e 76 65 72 | 74 20 62 65 74 77 65 65 |@ conver|t betwee|
|000021f0| 6e 20 63 68 61 72 61 63 | 74 65 72 73 0d 61 6e 64 |n charac|ters.and|
|00002200| 20 6e 6f 6e 6e 65 67 61 | 74 69 76 65 20 69 6e 74 | nonnega|tive int|
|00002210| 65 67 65 72 73 20 72 65 | 70 72 65 73 65 6e 74 69 |egers re|presenti|
|00002220| 6e 67 20 74 68 65 20 62 | 79 74 65 20 76 61 6c 75 |ng the b|yte valu|
|00002230| 65 73 2e 0d 42 79 74 65 | 73 20 77 69 74 68 20 74 |es..Byte|s with t|
|00002240| 68 65 20 76 61 6c 75 65 | 73 20 30 2d 31 32 37 20 |he value|s 0-127 |
|00002250| 72 65 70 72 65 73 65 6e | 74 20 74 68 65 20 63 6f |represen|t the co|
|00002260| 72 72 65 73 70 6f 6e 64 | 69 6e 67 20 5c 41 53 43 |rrespond|ing \ASC|
|00002270| 49 49 7b 7d 20 76 61 6c | 75 65 73 2e 0d 54 68 65 |II{} val|ues..The|
|00002280| 20 73 74 72 69 6e 67 20 | 64 61 74 61 20 74 79 70 | string |data typ|
|00002290| 65 20 69 73 20 61 6c 73 | 6f 20 75 73 65 64 20 74 |e is als|o used t|
|000022a0| 6f 20 72 65 70 72 65 73 | 65 6e 74 20 61 72 72 61 |o repres|ent arra|
|000022b0| 79 73 20 6f 66 20 62 79 | 74 65 73 2c 20 65 2e 67 |ys of by|tes, e.g|
|000022c0| 2e 0d 74 6f 20 68 6f 6c | 64 20 64 61 74 61 20 72 |..to hol|d data r|
|000022d0| 65 61 64 20 66 72 6f 6d | 20 61 20 66 69 6c 65 2e |ead from| a file.|
|000022e0| 0d 5c 6f 62 69 6e 64 65 | 78 7b 73 74 72 69 6e 67 |.\obinde|x{string|
|000022f0| 7d 0d 5c 69 6e 64 65 78 | 7b 63 68 61 72 61 63 74 |}.\index|{charact|
|00002300| 65 72 7d 0d 5c 69 6e 64 | 65 78 7b 62 79 74 65 7d |er}.\ind|ex{byte}|
|00002310| 0d 5c 69 6e 64 65 78 7b | 41 53 43 49 49 7d 0d 5c |.\index{|ASCII}.\|
|00002320| 62 69 66 75 6e 63 69 6e | 64 65 78 7b 63 68 72 7d |bifuncin|dex{chr}|
|00002330| 0d 5c 62 69 66 75 6e 63 | 69 6e 64 65 78 7b 6f 72 |.\bifunc|index{or|
|00002340| 64 7d 0d 0d 28 4f 6e 20 | 73 79 73 74 65 6d 73 20 |d}..(On |systems |
|00002350| 77 68 6f 73 65 20 6e 61 | 74 69 76 65 20 63 68 61 |whose na|tive cha|
|00002360| 72 61 63 74 65 72 20 73 | 65 74 20 69 73 20 6e 6f |racter s|et is no|
|00002370| 74 20 5c 41 53 43 49 49 | 7b 7d 2c 20 73 74 72 69 |t \ASCII|{}, stri|
|00002380| 6e 67 73 20 6d 61 79 20 | 75 73 65 0d 45 42 43 44 |ngs may |use.EBCD|
|00002390| 49 43 20 69 6e 20 74 68 | 65 69 72 20 69 6e 74 65 |IC in th|eir inte|
|000023a0| 72 6e 61 6c 20 72 65 70 | 72 65 73 65 6e 74 61 74 |rnal rep|resentat|
|000023b0| 69 6f 6e 2c 20 70 72 6f | 76 69 64 65 64 20 74 68 |ion, pro|vided th|
|000023c0| 65 20 66 75 6e 63 74 69 | 6f 6e 73 0d 5c 76 65 72 |e functi|ons.\ver|
|000023d0| 62 40 63 68 72 28 29 40 | 20 61 6e 64 20 5c 76 65 |b@chr()@| and \ve|
|000023e0| 72 62 40 6f 72 64 28 29 | 40 20 69 6d 70 6c 65 6d |rb@ord()|@ implem|
|000023f0| 65 6e 74 20 61 20 6d 61 | 70 70 69 6e 67 20 62 65 |ent a ma|pping be|
|00002400| 74 77 65 65 6e 20 5c 41 | 53 43 49 49 7b 7d 20 61 |tween \A|SCII{} a|
|00002410| 6e 64 0d 45 42 43 44 49 | 43 2c 20 61 6e 64 20 73 |nd.EBCDI|C, and s|
|00002420| 74 72 69 6e 67 20 63 6f | 6d 70 61 72 69 73 6f 6e |tring co|mparison|
|00002430| 20 70 72 65 73 65 72 76 | 65 73 20 74 68 65 20 5c | preserv|es the \|
|00002440| 41 53 43 49 49 7b 7d 20 | 6f 72 64 65 72 2e 0d 4f |ASCII{} |order..O|
|00002450| 72 20 70 65 72 68 61 70 | 73 20 73 6f 6d 65 6f 6e |r perhap|s someon|
|00002460| 65 20 63 61 6e 20 70 72 | 6f 70 6f 73 65 20 61 20 |e can pr|opose a |
|00002470| 62 65 74 74 65 72 20 72 | 75 6c 65 3f 29 0d 5c 69 |better r|ule?).\i|
|00002480| 6e 64 65 78 7b 41 53 43 | 49 49 7d 0d 5c 69 6e 64 |ndex{ASC|II}.\ind|
|00002490| 65 78 7b 45 42 43 44 49 | 43 7d 0d 5c 69 6e 64 65 |ex{EBCDI|C}.\inde|
|000024a0| 78 7b 63 68 61 72 61 63 | 74 65 72 20 73 65 74 7d |x{charac|ter set}|
|000024b0| 0d 5c 69 6e 64 65 78 69 | 69 7b 73 74 72 69 6e 67 |.\indexi|i{string|
|000024c0| 7d 7b 63 6f 6d 70 61 72 | 69 73 6f 6e 7d 0d 5c 62 |}{compar|ison}.\b|
|000024d0| 69 66 75 6e 63 69 6e 64 | 65 78 7b 63 68 72 7d 0d |ifuncind|ex{chr}.|
|000024e0| 5c 62 69 66 75 6e 63 69 | 6e 64 65 78 7b 6f 72 64 |\bifunci|ndex{ord|
|000024f0| 7d 0d 0d 5c 69 74 65 6d | 5b 54 75 70 6c 65 73 5d |}..\item|[Tuples]|
|00002500| 0d 54 68 65 20 65 6c 65 | 6d 65 6e 74 73 20 6f 66 |.The ele|ments of|
|00002510| 20 61 20 74 75 70 6c 65 | 20 61 72 65 20 61 72 62 | a tuple| are arb|
|00002520| 69 74 72 61 72 79 20 50 | 79 74 68 6f 6e 20 6f 62 |itrary P|ython ob|
|00002530| 6a 65 63 74 73 2e 0d 54 | 75 70 6c 65 73 20 6f 66 |jects..T|uples of|
|00002540| 20 74 77 6f 20 6f 72 20 | 6d 6f 72 65 20 65 6c 65 | two or |more ele|
|00002550| 6d 65 6e 74 73 20 61 72 | 65 20 66 6f 72 6d 65 64 |ments ar|e formed|
|00002560| 20 62 79 20 63 6f 6d 6d | 61 2d 73 65 70 61 72 61 | by comm|a-separa|
|00002570| 74 65 64 20 6c 69 73 74 | 73 0d 6f 66 20 65 78 70 |ted list|s.of exp|
|00002580| 72 65 73 73 69 6f 6e 73 | 2e 20 20 41 20 74 75 70 |ressions|. A tup|
|00002590| 6c 65 20 6f 66 20 6f 6e | 65 20 65 6c 65 6d 65 6e |le of on|e elemen|
|000025a0| 74 20 28 61 20 60 73 69 | 6e 67 6c 65 74 6f 6e 27 |t (a `si|ngleton'|
|000025b0| 29 20 63 61 6e 20 62 65 | 20 66 6f 72 6d 65 64 0d |) can be| formed.|
|000025c0| 62 79 20 61 66 66 69 78 | 69 6e 67 20 61 20 63 6f |by affix|ing a co|
|000025d0| 6d 6d 61 20 74 6f 20 61 | 6e 20 65 78 70 72 65 73 |mma to a|n expres|
|000025e0| 73 69 6f 6e 20 28 61 6e | 20 65 78 70 72 65 73 73 |sion (an| express|
|000025f0| 69 6f 6e 20 62 79 20 69 | 74 73 65 6c 66 20 64 6f |ion by i|tself do|
|00002600| 65 73 0d 6e 6f 74 20 63 | 72 65 61 74 65 20 61 20 |es.not c|reate a |
|00002610| 74 75 70 6c 65 2c 20 73 | 69 6e 63 65 20 70 61 72 |tuple, s|ince par|
|00002620| 65 6e 74 68 65 73 65 73 | 20 6d 75 73 74 20 62 65 |entheses| must be|
|00002630| 20 75 73 61 62 6c 65 20 | 66 6f 72 20 67 72 6f 75 | usable |for grou|
|00002640| 70 69 6e 67 20 6f 66 0d | 65 78 70 72 65 73 73 69 |ping of.|expressi|
|00002650| 6f 6e 73 29 2e 20 20 41 | 6e 20 65 6d 70 74 79 20 |ons). A|n empty |
|00002660| 74 75 70 6c 65 20 63 61 | 6e 20 62 65 20 66 6f 72 |tuple ca|n be for|
|00002670| 6d 65 64 20 62 79 20 65 | 6e 63 6c 6f 73 69 6e 67 |med by e|nclosing|
|00002680| 20 60 6e 6f 74 68 69 6e | 67 27 20 69 6e 0d 70 61 | `nothin|g' in.pa|
|00002690| 72 65 6e 74 68 65 73 65 | 73 2e 0d 5c 6f 62 69 6e |renthese|s..\obin|
|000026a0| 64 65 78 7b 74 75 70 6c | 65 7d 0d 5c 69 6e 64 65 |dex{tupl|e}.\inde|
|000026b0| 78 69 69 7b 73 69 6e 67 | 6c 65 74 6f 6e 7d 7b 74 |xii{sing|leton}{t|
|000026c0| 75 70 6c 65 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 65 |uple}.\i|ndexii{e|
|000026d0| 6d 70 74 79 7d 7b 74 75 | 70 6c 65 7d 0d 0d 5c 65 |mpty}{tu|ple}..\e|
|000026e0| 6e 64 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 20 |nd{descr|iption} |
|000026f0| 25 20 49 6d 6d 75 74 61 | 62 6c 65 20 73 65 71 75 |% Immuta|ble sequ|
|00002700| 65 6e 63 65 73 0d 0d 5c | 69 74 65 6d 5b 4d 75 74 |ences..\|item[Mut|
|00002710| 61 62 6c 65 20 73 65 71 | 75 65 6e 63 65 73 5d 0d |able seq|uences].|
|00002720| 4d 75 74 61 62 6c 65 20 | 73 65 71 75 65 6e 63 65 |Mutable |sequence|
|00002730| 73 20 63 61 6e 20 62 65 | 20 63 68 61 6e 67 65 64 |s can be| changed|
|00002740| 20 61 66 74 65 72 20 74 | 68 65 79 20 61 72 65 20 | after t|hey are |
|00002750| 63 72 65 61 74 65 64 2e | 20 20 54 68 65 0d 73 75 |created.| The.su|
|00002760| 62 73 63 72 69 70 74 69 | 6f 6e 20 61 6e 64 20 73 |bscripti|on and s|
|00002770| 6c 69 63 69 6e 67 20 6e | 6f 74 61 74 69 6f 6e 73 |licing n|otations|
|00002780| 20 63 61 6e 20 62 65 20 | 75 73 65 64 20 61 73 20 | can be |used as |
|00002790| 74 68 65 20 74 61 72 67 | 65 74 20 6f 66 0d 61 73 |the targ|et of.as|
|000027a0| 73 69 67 6e 6d 65 6e 74 | 20 61 6e 64 20 5c 76 65 |signment| and \ve|
|000027b0| 72 62 40 64 65 6c 40 20 | 28 64 65 6c 65 74 65 29 |rb@del@ |(delete)|
|000027c0| 20 73 74 61 74 65 6d 65 | 6e 74 73 2e 0d 5c 6f 62 | stateme|nts..\ob|
|000027d0| 69 6e 64 65 78 7b 6d 75 | 74 61 62 6c 65 20 73 65 |index{mu|table se|
|000027e0| 71 75 65 63 65 7d 0d 5c | 6f 62 69 6e 64 65 78 7b |quece}.\|obindex{|
|000027f0| 6d 75 74 61 62 6c 65 7d | 0d 5c 69 6e 64 65 78 69 |mutable}|.\indexi|
|00002800| 69 7b 61 73 73 69 67 6e | 6d 65 6e 74 7d 7b 73 74 |i{assign|ment}{st|
|00002810| 61 74 65 6d 65 6e 74 7d | 0d 5c 69 6e 64 65 78 7b |atement}|.\index{|
|00002820| 64 65 6c 65 74 65 7d 0d | 5c 73 74 69 6e 64 65 78 |delete}.|\stindex|
|00002830| 7b 64 65 6c 7d 0d 5c 69 | 6e 64 65 78 7b 73 75 62 |{del}.\i|ndex{sub|
|00002840| 73 63 72 69 70 74 69 6f | 6e 7d 0d 5c 69 6e 64 65 |scriptio|n}.\inde|
|00002850| 78 7b 73 6c 69 63 69 6e | 67 7d 0d 0d 54 68 65 72 |x{slicin|g}..Ther|
|00002860| 65 20 69 73 20 63 75 72 | 72 65 6e 74 6c 79 20 61 |e is cur|rently a|
|00002870| 20 73 69 6e 67 6c 65 20 | 6d 75 74 61 62 6c 65 20 | single |mutable |
|00002880| 73 65 71 75 65 6e 63 65 | 20 74 79 70 65 3a 0d 0d |sequence| type:..|
|00002890| 5c 62 65 67 69 6e 7b 64 | 65 73 63 72 69 70 74 69 |\begin{d|escripti|
|000028a0| 6f 6e 7d 0d 0d 5c 69 74 | 65 6d 5b 4c 69 73 74 73 |on}..\it|em[Lists|
|000028b0| 5d 0d 54 68 65 20 65 6c | 65 6d 65 6e 74 73 20 6f |].The el|ements o|
|000028c0| 66 20 61 20 6c 69 73 74 | 20 61 72 65 20 61 72 62 |f a list| are arb|
|000028d0| 69 74 72 61 72 79 20 50 | 79 74 68 6f 6e 20 6f 62 |itrary P|ython ob|
|000028e0| 6a 65 63 74 73 2e 20 20 | 4c 69 73 74 73 20 61 72 |jects. |Lists ar|
|000028f0| 65 20 66 6f 72 6d 65 64 | 0d 62 79 20 70 6c 61 63 |e formed|.by plac|
|00002900| 69 6e 67 20 61 20 63 6f | 6d 6d 61 2d 73 65 70 61 |ing a co|mma-sepa|
|00002910| 72 61 74 65 64 20 6c 69 | 73 74 20 6f 66 20 65 78 |rated li|st of ex|
|00002920| 70 72 65 73 73 69 6f 6e | 73 20 69 6e 20 73 71 75 |pression|s in squ|
|00002930| 61 72 65 20 62 72 61 63 | 6b 65 74 73 2e 0d 28 4e |are brac|kets..(N|
|00002940| 6f 74 65 20 74 68 61 74 | 20 74 68 65 72 65 20 61 |ote that| there a|
|00002950| 72 65 20 6e 6f 20 73 70 | 65 63 69 61 6c 20 63 61 |re no sp|ecial ca|
|00002960| 73 65 73 20 6e 65 65 64 | 65 64 20 74 6f 20 66 6f |ses need|ed to fo|
|00002970| 72 6d 20 6c 69 73 74 73 | 20 6f 66 20 6c 65 6e 67 |rm lists| of leng|
|00002980| 74 68 20 30 0d 6f 72 20 | 31 2e 29 0d 5c 6f 62 69 |th 0.or |1.).\obi|
|00002990| 6e 64 65 78 7b 6c 69 73 | 74 7d 0d 0d 5c 65 6e 64 |ndex{lis|t}..\end|
|000029a0| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 20 25 20 |{descrip|tion} % |
|000029b0| 4d 75 74 61 62 6c 65 20 | 73 65 71 75 65 6e 63 65 |Mutable |sequence|
|000029c0| 73 0d 0d 5c 65 6e 64 7b | 64 65 73 63 72 69 70 74 |s..\end{|descript|
|000029d0| 69 6f 6e 7d 20 25 20 53 | 65 71 75 65 6e 63 65 73 |ion} % S|equences|
|000029e0| 0d 0d 5c 69 74 65 6d 5b | 4d 61 70 70 69 6e 67 20 |..\item[|Mapping |
|000029f0| 74 79 70 65 73 5d 0d 54 | 68 65 73 65 20 72 65 70 |types].T|hese rep|
|00002a00| 72 65 73 65 6e 74 20 66 | 69 6e 69 74 65 20 73 65 |resent f|inite se|
|00002a10| 74 73 20 6f 66 20 6f 62 | 6a 65 63 74 73 20 69 6e |ts of ob|jects in|
|00002a20| 64 65 78 65 64 20 62 79 | 20 61 72 62 69 74 72 61 |dexed by| arbitra|
|00002a30| 72 79 20 69 6e 64 65 78 | 20 73 65 74 73 2e 0d 54 |ry index| sets..T|
|00002a40| 68 65 20 73 75 62 73 63 | 72 69 70 74 20 6e 6f 74 |he subsc|ript not|
|00002a50| 61 74 69 6f 6e 20 5c 76 | 65 72 62 40 61 5b 6b 5d |ation \v|erb@a[k]|
|00002a60| 40 20 73 65 6c 65 63 74 | 73 20 74 68 65 20 65 6c |@ select|s the el|
|00002a70| 65 6d 65 6e 74 20 69 6e | 64 65 78 65 64 0d 62 79 |ement in|dexed.by|
|00002a80| 20 5c 76 65 72 62 40 6b | 40 20 66 72 6f 6d 20 74 | \verb@k|@ from t|
|00002a90| 68 65 20 6d 61 70 70 69 | 6e 67 20 5c 76 65 72 62 |he mappi|ng \verb|
|00002aa0| 40 61 40 3b 20 74 68 69 | 73 20 63 61 6e 20 62 65 |@a@; thi|s can be|
|00002ab0| 20 75 73 65 64 20 69 6e | 0d 65 78 70 72 65 73 73 | used in|.express|
|00002ac0| 69 6f 6e 73 20 61 6e 64 | 20 61 73 20 74 68 65 20 |ions and| as the |
|00002ad0| 74 61 72 67 65 74 20 6f | 66 20 61 73 73 69 67 6e |target o|f assign|
|00002ae0| 6d 65 6e 74 73 20 6f 72 | 20 5c 76 65 72 62 40 64 |ments or| \verb@d|
|00002af0| 65 6c 40 20 73 74 61 74 | 65 6d 65 6e 74 73 2e 0d |el@ stat|ements..|
|00002b00| 54 68 65 20 62 75 69 6c | 74 2d 69 6e 20 66 75 6e |The buil|t-in fun|
|00002b10| 63 74 69 6f 6e 20 5c 76 | 65 72 62 40 6c 65 6e 28 |ction \v|erb@len(|
|00002b20| 29 40 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 6e |)@ retur|ns the n|
|00002b30| 75 6d 62 65 72 20 6f 66 | 20 65 6c 65 6d 65 6e 74 |umber of| element|
|00002b40| 73 0d 69 6e 20 61 20 6d | 61 70 70 69 6e 67 2e 0d |s.in a m|apping..|
|00002b50| 5c 62 69 66 75 6e 63 69 | 6e 64 65 78 7b 6c 65 6e |\bifunci|ndex{len|
|00002b60| 7d 0d 5c 69 6e 64 65 78 | 7b 73 75 62 73 63 72 69 |}.\index|{subscri|
|00002b70| 70 74 69 6f 6e 7d 0d 5c | 6f 62 69 6e 64 65 78 7b |ption}.\|obindex{|
|00002b80| 6d 61 70 70 69 6e 67 7d | 0d 0d 54 68 65 72 65 20 |mapping}|..There |
|00002b90| 69 73 20 63 75 72 72 65 | 6e 74 6c 79 20 61 20 73 |is curre|ntly a s|
|00002ba0| 69 6e 67 6c 65 20 6d 61 | 70 70 69 6e 67 20 74 79 |ingle ma|pping ty|
|00002bb0| 70 65 3a 0d 0d 5c 62 65 | 67 69 6e 7b 64 65 73 63 |pe:..\be|gin{desc|
|00002bc0| 72 69 70 74 69 6f 6e 7d | 0d 0d 5c 69 74 65 6d 5b |ription}|..\item[|
|00002bd0| 44 69 63 74 69 6f 6e 61 | 72 69 65 73 5d 0d 54 68 |Dictiona|ries].Th|
|00002be0| 65 73 65 20 72 65 70 72 | 65 73 65 6e 74 20 66 69 |ese repr|esent fi|
|00002bf0| 6e 69 74 65 20 73 65 74 | 73 20 6f 66 20 6f 62 6a |nite set|s of obj|
|00002c00| 65 63 74 73 20 69 6e 64 | 65 78 65 64 20 62 79 20 |ects ind|exed by |
|00002c10| 61 6c 6d 6f 73 74 20 61 | 72 62 69 74 72 61 72 79 |almost a|rbitrary|
|00002c20| 0d 76 61 6c 75 65 73 2e | 20 20 54 68 65 20 6f 6e |.values.| The on|
|00002c30| 6c 79 20 74 79 70 65 73 | 20 6f 66 20 76 61 6c 75 |ly types| of valu|
|00002c40| 65 73 20 6e 6f 74 20 61 | 63 63 65 70 74 61 62 6c |es not a|cceptabl|
|00002c50| 65 20 61 73 20 6b 65 79 | 73 20 61 72 65 20 76 61 |e as key|s are va|
|00002c60| 6c 75 65 73 0d 63 6f 6e | 74 61 69 6e 69 6e 67 20 |lues.con|taining |
|00002c70| 6c 69 73 74 73 20 6f 72 | 20 64 69 63 74 69 6f 6e |lists or| diction|
|00002c80| 61 72 69 65 73 20 6f 72 | 20 6f 74 68 65 72 20 6d |aries or| other m|
|00002c90| 75 74 61 62 6c 65 20 74 | 79 70 65 73 20 74 68 61 |utable t|ypes tha|
|00002ca0| 74 20 61 72 65 0d 63 6f | 6d 70 61 72 65 64 20 62 |t are.co|mpared b|
|00002cb0| 79 20 76 61 6c 75 65 20 | 72 61 74 68 65 72 20 74 |y value |rather t|
|00002cc0| 68 61 6e 20 62 79 20 6f | 62 6a 65 63 74 20 69 64 |han by o|bject id|
|00002cd0| 65 6e 74 69 74 79 20 2d | 2d 2d 20 74 68 65 20 72 |entity -|-- the r|
|00002ce0| 65 61 73 6f 6e 20 62 65 | 69 6e 67 0d 74 68 61 74 |eason be|ing.that|
|00002cf0| 20 74 68 65 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 | the imp|lementat|
|00002d00| 69 6f 6e 20 72 65 71 75 | 69 72 65 73 20 74 68 61 |ion requ|ires tha|
|00002d10| 74 20 61 20 6b 65 79 27 | 73 20 68 61 73 68 20 76 |t a key'|s hash v|
|00002d20| 61 6c 75 65 20 62 65 20 | 63 6f 6e 73 74 61 6e 74 |alue be |constant|
|00002d30| 2e 0d 4e 75 6d 65 72 69 | 63 20 74 79 70 65 73 20 |..Numeri|c types |
|00002d40| 75 73 65 64 20 66 6f 72 | 20 6b 65 79 73 20 6f 62 |used for| keys ob|
|00002d50| 65 79 20 74 68 65 20 6e | 6f 72 6d 61 6c 20 72 75 |ey the n|ormal ru|
|00002d60| 6c 65 73 20 66 6f 72 20 | 6e 75 6d 65 72 69 63 0d |les for |numeric.|
|00002d70| 63 6f 6d 70 61 72 69 73 | 6f 6e 3a 20 69 66 20 74 |comparis|on: if t|
|00002d80| 77 6f 20 6e 75 6d 62 65 | 72 73 20 63 6f 6d 70 61 |wo numbe|rs compa|
|00002d90| 72 65 20 65 71 75 61 6c | 20 28 65 2e 67 2e 20 31 |re equal| (e.g. 1|
|00002da0| 20 61 6e 64 20 31 2e 30 | 29 20 74 68 65 6e 20 74 | and 1.0|) then t|
|00002db0| 68 65 79 0d 63 61 6e 20 | 62 65 20 75 73 65 64 20 |hey.can |be used |
|00002dc0| 69 6e 74 65 72 63 68 61 | 6e 67 65 61 62 6c 79 20 |intercha|ngeably |
|00002dd0| 74 6f 20 69 6e 64 65 78 | 20 74 68 65 20 73 61 6d |to index| the sam|
|00002de0| 65 20 64 69 63 74 69 6f | 6e 61 72 79 20 65 6e 74 |e dictio|nary ent|
|00002df0| 72 79 2e 0d 0d 44 69 63 | 74 69 6f 6e 61 72 69 65 |ry...Dic|tionarie|
|00002e00| 73 20 61 72 65 20 6d 75 | 74 61 62 6c 65 3b 20 74 |s are mu|table; t|
|00002e10| 68 65 79 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |hey are |created |
|00002e20| 62 79 20 74 68 65 20 5c | 76 65 72 62 40 7b 2e 2e |by the \|verb@{..|
|00002e30| 2e 7d 40 0d 6e 6f 74 61 | 74 69 6f 6e 20 28 73 65 |.}@.nota|tion (se|
|00002e40| 65 20 73 65 63 74 69 6f | 6e 20 5c 72 65 66 7b 64 |e sectio|n \ref{d|
|00002e50| 69 63 74 7d 29 2e 0d 5c | 6f 62 69 6e 64 65 78 7b |ict})..\|obindex{|
|00002e60| 64 69 63 74 69 6f 6e 61 | 72 79 7d 0d 5c 6f 62 69 |dictiona|ry}.\obi|
|00002e70| 6e 64 65 78 7b 6d 75 74 | 61 62 6c 65 7d 0d 0d 5c |ndex{mut|able}..\|
|00002e80| 65 6e 64 7b 64 65 73 63 | 72 69 70 74 69 6f 6e 7d |end{desc|ription}|
|00002e90| 20 25 20 4d 61 70 70 69 | 6e 67 20 74 79 70 65 73 | % Mappi|ng types|
|00002ea0| 0d 0d 5c 69 74 65 6d 5b | 43 61 6c 6c 61 62 6c 65 |..\item[|Callable|
|00002eb0| 20 74 79 70 65 73 5d 0d | 54 68 65 73 65 20 61 72 | types].|These ar|
|00002ec0| 65 20 74 68 65 20 74 79 | 70 65 73 20 74 6f 20 77 |e the ty|pes to w|
|00002ed0| 68 69 63 68 20 74 68 65 | 20 66 75 6e 63 74 69 6f |hich the| functio|
|00002ee0| 6e 20 63 61 6c 6c 20 28 | 69 6e 76 6f 63 61 74 69 |n call (|invocati|
|00002ef0| 6f 6e 29 20 6f 70 65 72 | 61 74 69 6f 6e 2c 0d 77 |on) oper|ation,.w|
|00002f00| 72 69 74 74 65 6e 20 61 | 73 20 5c 76 65 72 62 40 |ritten a|s \verb@|
|00002f10| 66 75 6e 63 74 69 6f 6e | 28 61 72 67 75 6d 65 6e |function|(argumen|
|00002f20| 74 2c 20 61 72 67 75 6d | 65 6e 74 2c 20 2e 2e 2e |t, argum|ent, ...|
|00002f30| 29 40 2c 20 63 61 6e 20 | 62 65 20 61 70 70 6c 69 |)@, can |be appli|
|00002f40| 65 64 3a 0d 5c 69 6e 64 | 65 78 69 69 7b 66 75 6e |ed:.\ind|exii{fun|
|00002f50| 63 74 69 6f 6e 7d 7b 63 | 61 6c 6c 7d 0d 5c 69 6e |ction}{c|all}.\in|
|00002f60| 64 65 78 7b 69 6e 76 6f | 63 61 74 69 6f 6e 7d 0d |dex{invo|cation}.|
|00002f70| 5c 69 6e 64 65 78 69 69 | 7b 66 75 6e 63 74 69 6f |\indexii|{functio|
|00002f80| 6e 7d 7b 61 72 67 75 6d | 65 6e 74 7d 0d 5c 6f 62 |n}{argum|ent}.\ob|
|00002f90| 69 6e 64 65 78 7b 63 61 | 6c 6c 61 62 6c 65 7d 0d |index{ca|llable}.|
|00002fa0| 0d 5c 62 65 67 69 6e 7b | 64 65 73 63 72 69 70 74 |.\begin{|descript|
|00002fb0| 69 6f 6e 7d 0d 0d 5c 69 | 74 65 6d 5b 55 73 65 72 |ion}..\i|tem[User|
|00002fc0| 2d 64 65 66 69 6e 65 64 | 20 66 75 6e 63 74 69 6f |-defined| functio|
|00002fd0| 6e 73 5d 0d 41 20 75 73 | 65 72 2d 64 65 66 69 6e |ns].A us|er-defin|
|00002fe0| 65 64 20 66 75 6e 63 74 | 69 6f 6e 20 6f 62 6a 65 |ed funct|ion obje|
|00002ff0| 63 74 20 69 73 20 63 72 | 65 61 74 65 64 20 62 79 |ct is cr|eated by|
|00003000| 20 61 20 66 75 6e 63 74 | 69 6f 6e 20 64 65 66 69 | a funct|ion defi|
|00003010| 6e 69 74 69 6f 6e 0d 28 | 73 65 65 20 73 65 63 74 |nition.(|see sect|
|00003020| 69 6f 6e 20 5c 72 65 66 | 7b 66 75 6e 63 74 69 6f |ion \ref|{functio|
|00003030| 6e 7d 29 2e 20 20 49 74 | 20 73 68 6f 75 6c 64 20 |n}). It| should |
|00003040| 62 65 20 63 61 6c 6c 65 | 64 20 77 69 74 68 20 61 |be calle|d with a|
|00003050| 6e 20 61 72 67 75 6d 65 | 6e 74 0d 6c 69 73 74 20 |n argume|nt.list |
|00003060| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 74 68 65 20 73 |containi|ng the s|
|00003070| 61 6d 65 20 6e 75 6d 62 | 65 72 20 6f 66 20 69 74 |ame numb|er of it|
|00003080| 65 6d 73 20 61 73 20 74 | 68 65 20 66 75 6e 63 74 |ems as t|he funct|
|00003090| 69 6f 6e 27 73 20 66 6f | 72 6d 61 6c 0d 70 61 72 |ion's fo|rmal.par|
|000030a0| 61 6d 65 74 65 72 20 6c | 69 73 74 2e 0d 5c 69 6e |ameter l|ist..\in|
|000030b0| 64 65 78 69 69 7b 75 73 | 65 72 2d 64 65 66 69 6e |dexii{us|er-defin|
|000030c0| 65 64 7d 7b 66 75 6e 63 | 74 69 6f 6e 7d 0d 5c 6f |ed}{func|tion}.\o|
|000030d0| 62 69 6e 64 65 78 7b 66 | 75 6e 63 74 69 6f 6e 7d |bindex{f|unction}|
|000030e0| 0d 5c 6f 62 69 6e 64 65 | 78 7b 75 73 65 72 2d 64 |.\obinde|x{user-d|
|000030f0| 65 66 69 6e 65 64 20 66 | 75 6e 63 74 69 6f 6e 7d |efined f|unction}|
|00003100| 0d 0d 53 70 65 63 69 61 | 6c 20 72 65 61 64 2d 6f |..Specia|l read-o|
|00003110| 6e 6c 79 20 61 74 74 72 | 69 62 75 74 65 73 3a 20 |nly attr|ibutes: |
|00003120| 5c 76 65 72 62 40 66 75 | 6e 63 5f 63 6f 64 65 40 |\verb@fu|nc_code@|
|00003130| 20 69 73 20 74 68 65 20 | 63 6f 64 65 20 6f 62 6a | is the |code obj|
|00003140| 65 63 74 0d 72 65 70 72 | 65 73 65 6e 74 69 6e 67 |ect.repr|esenting|
|00003150| 20 74 68 65 20 63 6f 6d | 70 69 6c 65 64 20 66 75 | the com|piled fu|
|00003160| 6e 63 74 69 6f 6e 20 62 | 6f 64 79 2c 20 61 6e 64 |nction b|ody, and|
|00003170| 20 5c 76 65 72 62 40 66 | 75 6e 63 5f 67 6c 6f 62 | \verb@f|unc_glob|
|00003180| 61 6c 73 40 20 69 73 20 | 28 61 0d 72 65 66 65 72 |als@ is |(a.refer|
|00003190| 65 6e 63 65 20 74 6f 29 | 20 74 68 65 20 64 69 63 |ence to)| the dic|
|000031a0| 74 69 6f 6e 61 72 79 20 | 74 68 61 74 20 68 6f 6c |tionary |that hol|
|000031b0| 64 73 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 27 |ds the f|unction'|
|000031c0| 73 20 67 6c 6f 62 61 6c | 0d 76 61 72 69 61 62 6c |s global|.variabl|
|000031d0| 65 73 20 2d 2d 2d 20 69 | 74 20 69 6d 70 6c 65 6d |es --- i|t implem|
|000031e0| 65 6e 74 73 20 74 68 65 | 20 67 6c 6f 62 61 6c 20 |ents the| global |
|000031f0| 6e 61 6d 65 20 73 70 61 | 63 65 20 6f 66 20 74 68 |name spa|ce of th|
|00003200| 65 20 6d 6f 64 75 6c 65 | 20 69 6e 0d 77 68 69 63 |e module| in.whic|
|00003210| 68 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 77 |h the fu|nction w|
|00003220| 61 73 20 64 65 66 69 6e | 65 64 2e 0d 5c 74 74 69 |as defin|ed..\tti|
|00003230| 6e 64 65 78 7b 66 75 6e | 63 5f 63 6f 64 65 7d 0d |ndex{fun|c_code}.|
|00003240| 5c 74 74 69 6e 64 65 78 | 7b 66 75 6e 63 5f 67 6c |\ttindex|{func_gl|
|00003250| 6f 62 61 6c 73 7d 0d 5c | 69 6e 64 65 78 69 69 7b |obals}.\|indexii{|
|00003260| 67 6c 6f 62 61 6c 7d 7b | 6e 61 6d 65 20 73 70 61 |global}{|name spa|
|00003270| 63 65 7d 0d 0d 5c 69 74 | 65 6d 5b 55 73 65 72 2d |ce}..\it|em[User-|
|00003280| 64 65 66 69 6e 65 64 20 | 6d 65 74 68 6f 64 73 5d |defined |methods]|
|00003290| 0d 41 20 75 73 65 72 2d | 64 65 66 69 6e 65 64 20 |.A user-|defined |
|000032a0| 6d 65 74 68 6f 64 20 28 | 61 2e 6b 2e 61 2e 20 7b |method (|a.k.a. {|
|000032b0| 5c 65 6d 20 6f 62 6a 65 | 63 74 20 63 6c 6f 73 75 |\em obje|ct closu|
|000032c0| 72 65 7d 29 20 69 73 20 | 61 20 70 61 69 72 20 6f |re}) is |a pair o|
|000032d0| 66 20 61 0d 63 6c 61 73 | 73 20 69 6e 73 74 61 6e |f a.clas|s instan|
|000032e0| 63 65 20 6f 62 6a 65 63 | 74 20 61 6e 64 20 61 20 |ce objec|t and a |
|000032f0| 75 73 65 72 2d 64 65 66 | 69 6e 65 64 20 66 75 6e |user-def|ined fun|
|00003300| 63 74 69 6f 6e 2e 20 20 | 49 74 20 73 68 6f 75 6c |ction. |It shoul|
|00003310| 64 20 62 65 0d 63 61 6c | 6c 65 64 20 77 69 74 68 |d be.cal|led with|
|00003320| 20 61 6e 20 61 72 67 75 | 6d 65 6e 74 20 6c 69 73 | an argu|ment lis|
|00003330| 74 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 6f 6e 65 |t contai|ning one|
|00003340| 20 69 74 65 6d 20 6c 65 | 73 73 20 74 68 61 6e 20 | item le|ss than |
|00003350| 74 68 65 20 6e 75 6d 62 | 65 72 0d 6f 66 20 69 74 |the numb|er.of it|
|00003360| 65 6d 73 20 69 6e 20 74 | 68 65 20 66 75 6e 63 74 |ems in t|he funct|
|00003370| 69 6f 6e 27 73 20 66 6f | 72 6d 61 6c 20 70 61 72 |ion's fo|rmal par|
|00003380| 61 6d 65 74 65 72 20 6c | 69 73 74 2e 20 20 57 68 |ameter l|ist. Wh|
|00003390| 65 6e 20 63 61 6c 6c 65 | 64 2c 20 74 68 65 0d 63 |en calle|d, the.c|
|000033a0| 6c 61 73 73 20 69 6e 73 | 74 61 6e 63 65 20 62 65 |lass ins|tance be|
|000033b0| 63 6f 6d 65 73 20 74 68 | 65 20 66 69 72 73 74 20 |comes th|e first |
|000033c0| 61 72 67 75 6d 65 6e 74 | 2c 20 61 6e 64 20 74 68 |argument|, and th|
|000033d0| 65 20 63 61 6c 6c 20 61 | 72 67 75 6d 65 6e 74 73 |e call a|rguments|
|000033e0| 20 61 72 65 0d 73 68 69 | 66 74 65 64 20 6f 6e 65 | are.shi|fted one|
|000033f0| 20 74 6f 20 74 68 65 20 | 72 69 67 68 74 2e 0d 5c | to the |right..\|
|00003400| 6f 62 69 6e 64 65 78 7b | 6d 65 74 68 6f 64 7d 0d |obindex{|method}.|
|00003410| 5c 6f 62 69 6e 64 65 78 | 7b 75 73 65 72 2d 64 65 |\obindex|{user-de|
|00003420| 66 69 6e 65 64 20 6d 65 | 74 68 6f 64 7d 0d 5c 69 |fined me|thod}.\i|
|00003430| 6e 64 65 78 69 69 7b 75 | 73 65 72 2d 64 65 66 69 |ndexii{u|ser-defi|
|00003440| 6e 65 64 7d 7b 6d 65 74 | 68 6f 64 7d 0d 5c 69 6e |ned}{met|hod}.\in|
|00003450| 64 65 78 7b 6f 62 6a 65 | 63 74 20 63 6c 6f 73 75 |dex{obje|ct closu|
|00003460| 72 65 7d 0d 0d 53 70 65 | 63 69 61 6c 20 72 65 61 |re}..Spe|cial rea|
|00003470| 64 2d 6f 6e 6c 79 20 61 | 74 74 72 69 62 75 74 65 |d-only a|ttribute|
|00003480| 73 3a 20 5c 76 65 72 62 | 40 69 6d 5f 73 65 6c 66 |s: \verb|@im_self|
|00003490| 40 20 69 73 20 74 68 65 | 20 63 6c 61 73 73 20 69 |@ is the| class i|
|000034a0| 6e 73 74 61 6e 63 65 0d | 6f 62 6a 65 63 74 2c 20 |nstance.|object, |
|000034b0| 5c 76 65 72 62 40 69 6d | 5f 66 75 6e 63 40 20 69 |\verb@im|_func@ i|
|000034c0| 73 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 6f |s the fu|nction o|
|000034d0| 62 6a 65 63 74 2e 0d 5c | 74 74 69 6e 64 65 78 7b |bject..\|ttindex{|
|000034e0| 69 6d 5f 66 75 6e 63 7d | 0d 5c 74 74 69 6e 64 65 |im_func}|.\ttinde|
|000034f0| 78 7b 69 6d 5f 73 65 6c | 66 7d 0d 0d 5c 69 74 65 |x{im_sel|f}..\ite|
|00003500| 6d 5b 42 75 69 6c 74 2d | 69 6e 20 66 75 6e 63 74 |m[Built-|in funct|
|00003510| 69 6f 6e 73 5d 0d 41 20 | 62 75 69 6c 74 2d 69 6e |ions].A |built-in|
|00003520| 20 66 75 6e 63 74 69 6f | 6e 20 6f 62 6a 65 63 74 | functio|n object|
|00003530| 20 69 73 20 61 20 77 72 | 61 70 70 65 72 20 61 72 | is a wr|apper ar|
|00003540| 6f 75 6e 64 20 61 20 43 | 20 66 75 6e 63 74 69 6f |ound a C| functio|
|00003550| 6e 2e 20 20 45 78 61 6d | 70 6c 65 73 0d 6f 66 20 |n. Exam|ples.of |
|00003560| 62 75 69 6c 74 2d 69 6e | 20 66 75 6e 63 74 69 6f |built-in| functio|
|00003570| 6e 73 20 61 72 65 20 5c | 76 65 72 62 40 6c 65 6e |ns are \|verb@len|
|00003580| 40 20 61 6e 64 20 5c 76 | 65 72 62 40 6d 61 74 68 |@ and \v|erb@math|
|00003590| 2e 73 69 6e 40 2e 20 20 | 54 68 65 72 65 0d 61 72 |.sin@. |There.ar|
|000035a0| 65 20 6e 6f 20 73 70 65 | 63 69 61 6c 20 61 74 74 |e no spe|cial att|
|000035b0| 72 69 62 75 74 65 73 2e | 20 20 54 68 65 20 6e 75 |ributes.| The nu|
|000035c0| 6d 62 65 72 20 61 6e 64 | 20 74 79 70 65 20 6f 66 |mber and| type of|
|000035d0| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 61 | the arg|uments a|
|000035e0| 72 65 0d 64 65 74 65 72 | 6d 69 6e 65 64 20 62 79 |re.deter|mined by|
|000035f0| 20 74 68 65 20 43 20 66 | 75 6e 63 74 69 6f 6e 2e | the C f|unction.|
|00003600| 0d 5c 6f 62 69 6e 64 65 | 78 7b 62 75 69 6c 74 2d |.\obinde|x{built-|
|00003610| 69 6e 20 66 75 6e 63 74 | 69 6f 6e 7d 0d 5c 6f 62 |in funct|ion}.\ob|
|00003620| 69 6e 64 65 78 7b 66 75 | 6e 63 74 69 6f 6e 7d 0d |index{fu|nction}.|
|00003630| 5c 69 6e 64 65 78 7b 43 | 7d 0d 0d 5c 69 74 65 6d |\index{C|}..\item|
|00003640| 5b 42 75 69 6c 74 2d 69 | 6e 20 6d 65 74 68 6f 64 |[Built-i|n method|
|00003650| 73 5d 0d 54 68 69 73 20 | 69 73 20 72 65 61 6c 6c |s].This |is reall|
|00003660| 79 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 64 69 |y a diff|erent di|
|00003670| 73 67 75 69 73 65 20 6f | 66 20 61 20 62 75 69 6c |sguise o|f a buil|
|00003680| 74 2d 69 6e 20 66 75 6e | 63 74 69 6f 6e 2c 20 74 |t-in fun|ction, t|
|00003690| 68 69 73 20 74 69 6d 65 | 0d 63 6f 6e 74 61 69 6e |his time|.contain|
|000036a0| 69 6e 67 20 61 6e 20 6f | 62 6a 65 63 74 20 70 61 |ing an o|bject pa|
|000036b0| 73 73 65 64 20 74 6f 20 | 74 68 65 20 43 20 66 75 |ssed to |the C fu|
|000036c0| 6e 63 74 69 6f 6e 20 61 | 73 20 61 6e 20 69 6d 70 |nction a|s an imp|
|000036d0| 6c 69 63 69 74 20 65 78 | 74 72 61 0d 61 72 67 75 |licit ex|tra.argu|
|000036e0| 6d 65 6e 74 2e 20 20 41 | 6e 20 65 78 61 6d 70 6c |ment. A|n exampl|
|000036f0| 65 20 6f 66 20 61 20 62 | 75 69 6c 74 2d 69 6e 20 |e of a b|uilt-in |
|00003700| 6d 65 74 68 6f 64 20 69 | 73 20 5c 76 65 72 62 40 |method i|s \verb@|
|00003710| 6c 69 73 74 2e 61 70 70 | 65 6e 64 40 20 69 66 0d |list.app|end@ if.|
|00003720| 5c 76 65 72 62 40 6c 69 | 73 74 40 20 69 73 20 61 |\verb@li|st@ is a|
|00003730| 20 6c 69 73 74 20 6f 62 | 6a 65 63 74 2e 0d 5c 6f | list ob|ject..\o|
|00003740| 62 69 6e 64 65 78 7b 62 | 75 69 6c 74 2d 69 6e 20 |bindex{b|uilt-in |
|00003750| 6d 65 74 68 6f 64 7d 0d | 5c 6f 62 69 6e 64 65 78 |method}.|\obindex|
|00003760| 7b 6d 65 74 68 6f 64 7d | 0d 5c 69 6e 64 65 78 69 |{method}|.\indexi|
|00003770| 69 7b 62 75 69 6c 74 2d | 69 6e 7d 7b 6d 65 74 68 |i{built-|in}{meth|
|00003780| 6f 64 7d 0d 0d 5c 69 74 | 65 6d 5b 43 6c 61 73 73 |od}..\it|em[Class|
|00003790| 65 73 5d 0d 43 6c 61 73 | 73 20 6f 62 6a 65 63 74 |es].Clas|s object|
|000037a0| 73 20 61 72 65 20 64 65 | 73 63 72 69 62 65 64 20 |s are de|scribed |
|000037b0| 62 65 6c 6f 77 2e 20 20 | 57 68 65 6e 20 61 20 63 |below. |When a c|
|000037c0| 6c 61 73 73 20 6f 62 6a | 65 63 74 20 69 73 20 63 |lass obj|ect is c|
|000037d0| 61 6c 6c 65 64 20 61 73 | 20 61 0d 66 75 6e 63 74 |alled as| a.funct|
|000037e0| 69 6f 6e 2c 20 61 20 6e | 65 77 20 63 6c 61 73 73 |ion, a n|ew class|
|000037f0| 20 69 6e 73 74 61 6e 63 | 65 20 28 61 6c 73 6f 20 | instanc|e (also |
|00003800| 64 65 73 63 72 69 62 65 | 64 20 62 65 6c 6f 77 29 |describe|d below)|
|00003810| 20 69 73 20 63 72 65 61 | 74 65 64 20 61 6e 64 0d | is crea|ted and.|
|00003820| 72 65 74 75 72 6e 65 64 | 2e 20 20 54 68 69 73 20 |returned|. This |
|00003830| 69 6d 70 6c 69 65 73 20 | 61 20 63 61 6c 6c 20 74 |implies |a call t|
|00003840| 6f 20 74 68 65 20 63 6c | 61 73 73 27 73 20 5c 76 |o the cl|ass's \v|
|00003850| 65 72 62 40 5f 5f 69 6e | 69 74 5f 5f 40 20 6d 65 |erb@__in|it__@ me|
|00003860| 74 68 6f 64 0d 69 66 20 | 69 74 20 68 61 73 20 6f |thod.if |it has o|
|00003870| 6e 65 2e 20 20 41 6e 79 | 20 61 72 67 75 6d 65 6e |ne. Any| argumen|
|00003880| 74 73 20 61 72 65 20 70 | 61 73 73 65 64 20 6f 6e |ts are p|assed on|
|00003890| 20 74 6f 20 74 68 65 20 | 5c 76 65 72 62 40 5f 5f | to the |\verb@__|
|000038a0| 69 6e 69 74 5f 5f 40 0d | 6d 65 74 68 6f 64 20 2d |init__@.|method -|
|000038b0| 2d 2d 20 69 66 20 74 68 | 65 72 65 20 69 73 20 6e |-- if th|ere is n|
|000038c0| 6f 20 5c 76 65 72 62 40 | 5f 5f 69 6e 69 74 5f 5f |o \verb@|__init__|
|000038d0| 40 20 6d 65 74 68 6f 64 | 2c 20 74 68 65 20 63 6c |@ method|, the cl|
|000038e0| 61 73 73 20 6d 75 73 74 | 20 62 65 20 63 61 6c 6c |ass must| be call|
|000038f0| 65 64 0d 77 69 74 68 6f | 75 74 20 61 72 67 75 6d |ed.witho|ut argum|
|00003900| 65 6e 74 73 2e 0d 5c 74 | 74 69 6e 64 65 78 7b 5f |ents..\t|tindex{_|
|00003910| 5f 69 6e 69 74 5f 5f 7d | 0d 5c 6f 62 69 6e 64 65 |_init__}|.\obinde|
|00003920| 78 7b 63 6c 61 73 73 7d | 0d 5c 6f 62 69 6e 64 65 |x{class}|.\obinde|
|00003930| 78 7b 63 6c 61 73 73 20 | 69 6e 73 74 61 6e 63 65 |x{class |instance|
|00003940| 7d 0d 5c 6f 62 69 6e 64 | 65 78 7b 69 6e 73 74 61 |}.\obind|ex{insta|
|00003950| 6e 63 65 7d 0d 5c 69 6e | 64 65 78 69 69 7b 63 6c |nce}.\in|dexii{cl|
|00003960| 61 73 73 20 6f 62 6a 65 | 63 74 7d 7b 63 61 6c 6c |ass obje|ct}{call|
|00003970| 7d 0d 0d 5c 65 6e 64 7b | 64 65 73 63 72 69 70 74 |}..\end{|descript|
|00003980| 69 6f 6e 7d 0d 0d 5c 69 | 74 65 6d 5b 4d 6f 64 75 |ion}..\i|tem[Modu|
|00003990| 6c 65 73 5d 0d 4d 6f 64 | 75 6c 65 73 20 61 72 65 |les].Mod|ules are|
|000039a0| 20 69 6d 70 6f 72 74 65 | 64 20 62 79 20 74 68 65 | importe|d by the|
|000039b0| 20 5c 76 65 72 62 40 69 | 6d 70 6f 72 74 40 20 73 | \verb@i|mport@ s|
|000039c0| 74 61 74 65 6d 65 6e 74 | 20 28 73 65 65 20 73 65 |tatement| (see se|
|000039d0| 63 74 69 6f 6e 0d 5c 72 | 65 66 7b 69 6d 70 6f 72 |ction.\r|ef{impor|
|000039e0| 74 7d 29 2e 20 20 41 20 | 6d 6f 64 75 6c 65 20 6f |t}). A |module o|
|000039f0| 62 6a 65 63 74 20 69 73 | 20 61 20 63 6f 6e 74 61 |bject is| a conta|
|00003a00| 69 6e 65 72 20 66 6f 72 | 20 61 20 6d 6f 64 75 6c |iner for| a modul|
|00003a10| 65 27 73 20 6e 61 6d 65 | 0d 73 70 61 63 65 2c 20 |e's name|.space, |
|00003a20| 77 68 69 63 68 20 69 73 | 20 61 20 64 69 63 74 69 |which is| a dicti|
|00003a30| 6f 6e 61 72 79 20 28 74 | 68 65 20 73 61 6d 65 20 |onary (t|he same |
|00003a40| 64 69 63 74 69 6f 6e 61 | 72 79 20 61 73 20 72 65 |dictiona|ry as re|
|00003a50| 66 65 72 65 6e 63 65 64 | 20 62 79 20 74 68 65 0d |ferenced| by the.|
|00003a60| 5c 76 65 72 62 40 66 75 | 6e 63 5f 67 6c 6f 62 61 |\verb@fu|nc_globa|
|00003a70| 6c 73 40 20 61 74 74 72 | 69 62 75 74 65 20 6f 66 |ls@ attr|ibute of|
|00003a80| 20 66 75 6e 63 74 69 6f | 6e 73 20 64 65 66 69 6e | functio|ns defin|
|00003a90| 65 64 20 69 6e 20 74 68 | 65 20 6d 6f 64 75 6c 65 |ed in th|e module|
|00003aa0| 29 2e 0d 4d 6f 64 75 6c | 65 20 61 74 74 72 69 62 |)..Modul|e attrib|
|00003ab0| 75 74 65 20 72 65 66 65 | 72 65 6e 63 65 73 20 61 |ute refe|rences a|
|00003ac0| 72 65 20 74 72 61 6e 73 | 6c 61 74 65 64 20 74 6f |re trans|lated to|
|00003ad0| 20 6c 6f 6f 6b 75 70 73 | 20 69 6e 20 74 68 69 73 | lookups| in this|
|00003ae0| 0d 64 69 63 74 69 6f 6e | 61 72 79 2e 20 20 41 20 |.diction|ary. A |
|00003af0| 6d 6f 64 75 6c 65 20 6f | 62 6a 65 63 74 20 64 6f |module o|bject do|
|00003b00| 65 73 20 6e 6f 74 20 63 | 6f 6e 74 61 69 6e 20 74 |es not c|ontain t|
|00003b10| 68 65 20 63 6f 64 65 20 | 6f 62 6a 65 63 74 20 75 |he code |object u|
|00003b20| 73 65 64 20 74 6f 0d 69 | 6e 69 74 69 61 6c 69 7a |sed to.i|nitializ|
|00003b30| 65 20 74 68 65 20 6d 6f | 64 75 6c 65 20 28 73 69 |e the mo|dule (si|
|00003b40| 6e 63 65 20 69 74 20 69 | 73 6e 27 74 20 6e 65 65 |nce it i|sn't nee|
|00003b50| 64 65 64 20 6f 6e 63 65 | 20 74 68 65 20 69 6e 69 |ded once| the ini|
|00003b60| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 0d 69 73 20 64 |tializat|ion.is d|
|00003b70| 6f 6e 65 29 2e 0d 5c 73 | 74 69 6e 64 65 78 7b 69 |one)..\s|tindex{i|
|00003b80| 6d 70 6f 72 74 7d 0d 5c | 6f 62 69 6e 64 65 78 7b |mport}.\|obindex{|
|00003b90| 6d 6f 64 75 6c 65 7d 0d | 0d 41 74 74 72 69 62 75 |module}.|.Attribu|
|00003ba0| 74 65 20 61 73 73 69 67 | 6e 6d 65 6e 74 20 75 70 |te assig|nment up|
|00003bb0| 64 61 74 65 20 74 68 65 | 20 6d 6f 64 75 6c 65 27 |date the| module'|
|00003bc0| 73 20 6e 61 6d 65 20 73 | 70 61 63 65 20 64 69 63 |s name s|pace dic|
|00003bd0| 74 69 6f 6e 61 72 79 2e | 0d 0d 53 70 65 63 69 61 |tionary.|..Specia|
|00003be0| 6c 20 72 65 61 64 2d 6f | 6e 6c 79 20 61 74 74 72 |l read-o|nly attr|
|00003bf0| 69 62 75 74 65 73 3a 20 | 5c 76 65 72 62 40 5f 5f |ibutes: |\verb@__|
|00003c00| 64 69 63 74 5f 5f 40 20 | 79 69 65 6c 64 73 20 74 |dict__@ |yields t|
|00003c10| 68 65 20 6d 6f 64 75 6c | 65 27 73 20 6e 61 6d 65 |he modul|e's name|
|00003c20| 0d 73 70 61 63 65 20 61 | 73 20 61 20 64 69 63 74 |.space a|s a dict|
|00003c30| 69 6f 6e 61 72 79 20 6f | 62 6a 65 63 74 3b 20 5c |ionary o|bject; \|
|00003c40| 76 65 72 62 40 5f 5f 6e | 61 6d 65 5f 5f 40 20 79 |verb@__n|ame__@ y|
|00003c50| 69 65 6c 64 73 20 74 68 | 65 20 6d 6f 64 75 6c 65 |ields th|e module|
|00003c60| 27 73 20 6e 61 6d 65 0d | 61 73 20 61 20 73 74 72 |'s name.|as a str|
|00003c70| 69 6e 67 20 6f 62 6a 65 | 63 74 2e 0d 5c 74 74 69 |ing obje|ct..\tti|
|00003c80| 6e 64 65 78 7b 5f 5f 64 | 69 63 74 5f 5f 7d 0d 5c |ndex{__d|ict__}.\|
|00003c90| 74 74 69 6e 64 65 78 7b | 5f 5f 6e 61 6d 65 5f 5f |ttindex{|__name__|
|00003ca0| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 6d 6f 64 75 6c |}.\index|ii{modul|
|00003cb0| 65 7d 7b 6e 61 6d 65 20 | 73 70 61 63 65 7d 0d 0d |e}{name |space}..|
|00003cc0| 5c 69 74 65 6d 5b 43 6c | 61 73 73 65 73 5d 0d 43 |\item[Cl|asses].C|
|00003cd0| 6c 61 73 73 20 6f 62 6a | 65 63 74 73 20 61 72 65 |lass obj|ects are|
|00003ce0| 20 63 72 65 61 74 65 64 | 20 62 79 20 63 6c 61 73 | created| by clas|
|00003cf0| 73 20 64 65 66 69 6e 69 | 74 69 6f 6e 73 20 28 73 |s defini|tions (s|
|00003d00| 65 65 20 73 65 63 74 69 | 6f 6e 0d 5c 72 65 66 7b |ee secti|on.\ref{|
|00003d10| 63 6c 61 73 73 7d 29 2e | 20 20 41 20 63 6c 61 73 |class}).| A clas|
|00003d20| 73 20 69 73 20 61 20 63 | 6f 6e 74 61 69 6e 65 72 |s is a c|ontainer|
|00003d30| 20 66 6f 72 20 61 20 64 | 69 63 74 69 6f 6e 61 72 | for a d|ictionar|
|00003d40| 79 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 74 68 65 |y contai|ning the|
|00003d50| 0d 63 6c 61 73 73 27 73 | 20 6e 61 6d 65 20 73 70 |.class's| name sp|
|00003d60| 61 63 65 2e 20 20 43 6c | 61 73 73 20 61 74 74 72 |ace. Cl|ass attr|
|00003d70| 69 62 75 74 65 20 72 65 | 66 65 72 65 6e 63 65 73 |ibute re|ferences|
|00003d80| 20 61 72 65 20 74 72 61 | 6e 73 6c 61 74 65 64 20 | are tra|nslated |
|00003d90| 74 6f 0d 6c 6f 6f 6b 75 | 70 73 20 69 6e 20 74 68 |to.looku|ps in th|
|00003da0| 69 73 20 64 69 63 74 69 | 6f 6e 61 72 79 2e 20 20 |is dicti|onary. |
|00003db0| 57 68 65 6e 20 61 6e 20 | 61 74 74 72 69 62 75 74 |When an |attribut|
|00003dc0| 65 20 6e 61 6d 65 20 69 | 73 20 6e 6f 74 20 66 6f |e name i|s not fo|
|00003dd0| 75 6e 64 0d 74 68 65 72 | 65 2c 20 74 68 65 20 61 |und.ther|e, the a|
|00003de0| 74 74 72 69 62 75 74 65 | 20 73 65 61 72 63 68 20 |ttribute| search |
|00003df0| 63 6f 6e 74 69 6e 75 65 | 73 20 69 6e 20 74 68 65 |continue|s in the|
|00003e00| 20 62 61 73 65 20 63 6c | 61 73 73 65 73 2e 20 20 | base cl|asses. |
|00003e10| 54 68 65 20 73 65 61 72 | 63 68 0d 69 73 20 64 65 |The sear|ch.is de|
|00003e20| 70 74 68 2d 66 69 72 73 | 74 2c 20 6c 65 66 74 2d |pth-firs|t, left-|
|00003e30| 74 6f 2d 72 69 67 68 74 | 20 69 6e 20 74 68 65 20 |to-right| in the |
|00003e40| 6f 72 64 65 72 20 6f 66 | 20 74 68 65 69 72 20 6f |order of| their o|
|00003e50| 63 63 75 72 72 65 6e 63 | 65 20 69 6e 20 74 68 65 |ccurrenc|e in the|
|00003e60| 0d 62 61 73 65 20 63 6c | 61 73 73 20 6c 69 73 74 |.base cl|ass list|
|00003e70| 2e 0d 5c 6f 62 69 6e 64 | 65 78 7b 63 6c 61 73 73 |..\obind|ex{class|
|00003e80| 7d 0d 5c 6f 62 69 6e 64 | 65 78 7b 63 6c 61 73 73 |}.\obind|ex{class|
|00003e90| 20 69 6e 73 74 61 6e 63 | 65 7d 0d 5c 6f 62 69 6e | instanc|e}.\obin|
|00003ea0| 64 65 78 7b 69 6e 73 74 | 61 6e 63 65 7d 0d 5c 69 |dex{inst|ance}.\i|
|00003eb0| 6e 64 65 78 69 69 7b 63 | 6c 61 73 73 20 6f 62 6a |ndexii{c|lass obj|
|00003ec0| 65 63 74 7d 7b 63 61 6c | 6c 7d 0d 5c 69 6e 64 65 |ect}{cal|l}.\inde|
|00003ed0| 78 7b 63 6f 6e 74 61 69 | 6e 65 72 7d 0d 5c 6f 62 |x{contai|ner}.\ob|
|00003ee0| 69 6e 64 65 78 7b 64 69 | 63 74 69 6f 6e 61 72 79 |index{di|ctionary|
|00003ef0| 7d 0d 5c 69 6e 64 65 78 | 69 69 7b 63 6c 61 73 73 |}.\index|ii{class|
|00003f00| 7d 7b 61 74 74 72 69 62 | 75 74 65 7d 0d 0d 43 6c |}{attrib|ute}..Cl|
|00003f10| 61 73 73 20 61 74 74 72 | 69 62 75 74 65 20 61 73 |ass attr|ibute as|
|00003f20| 73 69 67 6e 6d 65 6e 74 | 73 20 75 70 64 61 74 65 |signment|s update|
|00003f30| 20 74 68 65 20 63 6c 61 | 73 73 27 73 20 64 69 63 | the cla|ss's dic|
|00003f40| 74 69 6f 6e 61 72 79 2c | 20 6e 65 76 65 72 20 74 |tionary,| never t|
|00003f50| 68 65 0d 64 69 63 74 69 | 6f 6e 61 72 79 20 6f 66 |he.dicti|onary of|
|00003f60| 20 61 20 62 61 73 65 20 | 63 6c 61 73 73 2e 0d 5c | a base |class..\|
|00003f70| 69 6e 64 65 78 69 69 69 | 7b 63 6c 61 73 73 7d 7b |indexiii|{class}{|
|00003f80| 61 74 74 72 69 62 75 74 | 65 7d 7b 61 73 73 69 67 |attribut|e}{assig|
|00003f90| 6e 6d 65 6e 74 7d 0d 0d | 41 20 63 6c 61 73 73 20 |nment}..|A class |
|00003fa0| 63 61 6e 20 62 65 20 63 | 61 6c 6c 65 64 20 61 73 |can be c|alled as|
|00003fb0| 20 61 20 66 75 6e 63 74 | 69 6f 6e 20 74 6f 20 79 | a funct|ion to y|
|00003fc0| 69 65 6c 64 20 61 20 63 | 6c 61 73 73 20 69 6e 73 |ield a c|lass ins|
|00003fd0| 74 61 6e 63 65 20 28 73 | 65 65 0d 61 62 6f 76 65 |tance (s|ee.above|
|00003fe0| 29 2e 0d 5c 69 6e 64 65 | 78 69 69 7b 63 6c 61 73 |)..\inde|xii{clas|
|00003ff0| 73 20 6f 62 6a 65 63 74 | 7d 7b 63 61 6c 6c 7d 0d |s object|}{call}.|
|00004000| 0d 53 70 65 63 69 61 6c | 20 72 65 61 64 2d 6f 6e |.Special| read-on|
|00004010| 6c 79 20 61 74 74 72 69 | 62 75 74 65 73 3a 20 5c |ly attri|butes: \|
|00004020| 76 65 72 62 40 5f 5f 64 | 69 63 74 5f 5f 40 20 79 |verb@__d|ict__@ y|
|00004030| 69 65 6c 64 73 20 74 68 | 65 20 64 69 63 74 69 6f |ields th|e dictio|
|00004040| 6e 61 72 79 0d 63 6f 6e | 74 61 69 6e 69 6e 67 20 |nary.con|taining |
|00004050| 74 68 65 20 63 6c 61 73 | 73 27 73 20 6e 61 6d 65 |the clas|s's name|
|00004060| 20 73 70 61 63 65 3b 20 | 5c 76 65 72 62 40 5f 5f | space; |\verb@__|
|00004070| 62 61 73 65 73 5f 5f 40 | 20 79 69 65 6c 64 73 20 |bases__@| yields |
|00004080| 61 20 74 75 70 6c 65 0d | 28 70 6f 73 73 69 62 6c |a tuple.|(possibl|
|00004090| 79 20 65 6d 70 74 79 20 | 6f 72 20 61 20 73 69 6e |y empty |or a sin|
|000040a0| 67 6c 65 74 6f 6e 29 20 | 63 6f 6e 74 61 69 6e 69 |gleton) |containi|
|000040b0| 6e 67 20 74 68 65 20 62 | 61 73 65 20 63 6c 61 73 |ng the b|ase clas|
|000040c0| 73 65 73 2c 20 69 6e 20 | 74 68 65 0d 6f 72 64 65 |ses, in |the.orde|
|000040d0| 72 20 6f 66 20 74 68 65 | 69 72 20 6f 63 63 75 72 |r of the|ir occur|
|000040e0| 72 65 6e 63 65 20 69 6e | 20 74 68 65 20 62 61 73 |rence in| the bas|
|000040f0| 65 20 63 6c 61 73 73 20 | 6c 69 73 74 2e 0d 5c 74 |e class |list..\t|
|00004100| 74 69 6e 64 65 78 7b 5f | 5f 64 69 63 74 5f 5f 7d |tindex{_|_dict__}|
|00004110| 0d 5c 74 74 69 6e 64 65 | 78 7b 5f 5f 62 61 73 65 |.\ttinde|x{__base|
|00004120| 73 5f 5f 7d 0d 0d 5c 69 | 74 65 6d 5b 43 6c 61 73 |s__}..\i|tem[Clas|
|00004130| 73 20 69 6e 73 74 61 6e | 63 65 73 5d 0d 41 20 63 |s instan|ces].A c|
|00004140| 6c 61 73 73 20 69 6e 73 | 74 61 6e 63 65 20 69 73 |lass ins|tance is|
|00004150| 20 63 72 65 61 74 65 64 | 20 62 79 20 63 61 6c 6c | created| by call|
|00004160| 69 6e 67 20 61 20 63 6c | 61 73 73 20 6f 62 6a 65 |ing a cl|ass obje|
|00004170| 63 74 20 61 73 20 61 0d | 66 75 6e 63 74 69 6f 6e |ct as a.|function|
|00004180| 2e 20 20 41 20 63 6c 61 | 73 73 20 69 6e 73 74 61 |. A cla|ss insta|
|00004190| 6e 63 65 20 68 61 73 20 | 61 20 64 69 63 74 69 6f |nce has |a dictio|
|000041a0| 6e 61 72 79 20 69 6e 20 | 77 68 69 63 68 0d 61 74 |nary in |which.at|
|000041b0| 74 72 69 62 75 74 65 20 | 72 65 66 65 72 65 6e 63 |tribute |referenc|
|000041c0| 65 73 20 61 72 65 20 73 | 65 61 72 63 68 65 64 2e |es are s|earched.|
|000041d0| 20 20 57 68 65 6e 20 61 | 6e 20 61 74 74 72 69 62 | When a|n attrib|
|000041e0| 75 74 65 20 69 73 20 6e | 6f 74 20 66 6f 75 6e 64 |ute is n|ot found|
|000041f0| 0d 74 68 65 72 65 2c 20 | 61 6e 64 20 74 68 65 20 |.there, |and the |
|00004200| 69 6e 73 74 61 6e 63 65 | 27 73 20 63 6c 61 73 73 |instance|'s class|
|00004210| 20 68 61 73 20 61 6e 20 | 61 74 74 72 69 62 75 74 | has an |attribut|
|00004220| 65 20 62 79 20 74 68 61 | 74 20 6e 61 6d 65 2c 20 |e by tha|t name, |
|00004230| 61 6e 64 0d 74 68 61 74 | 20 63 6c 61 73 73 20 61 |and.that| class a|
|00004240| 74 74 72 69 62 75 74 65 | 20 69 73 20 61 20 75 73 |ttribute| is a us|
|00004250| 65 72 2d 64 65 66 69 6e | 65 64 20 66 75 6e 63 74 |er-defin|ed funct|
|00004260| 69 6f 6e 20 28 61 6e 64 | 20 69 6e 20 6e 6f 20 6f |ion (and| in no o|
|00004270| 74 68 65 72 0d 63 61 73 | 65 73 29 2c 20 74 68 65 |ther.cas|es), the|
|00004280| 20 69 6e 73 74 61 6e 63 | 65 20 61 74 74 72 69 62 | instanc|e attrib|
|00004290| 75 74 65 20 72 65 66 65 | 72 65 6e 63 65 20 79 69 |ute refe|rence yi|
|000042a0| 65 6c 64 73 20 61 20 75 | 73 65 72 2d 64 65 66 69 |elds a u|ser-defi|
|000042b0| 6e 65 64 20 6d 65 74 68 | 6f 64 0d 6f 62 6a 65 63 |ned meth|od.objec|
|000042c0| 74 20 28 73 65 65 20 61 | 62 6f 76 65 29 20 63 6f |t (see a|bove) co|
|000042d0| 6e 73 74 72 75 63 74 65 | 64 20 66 72 6f 6d 20 74 |nstructe|d from t|
|000042e0| 68 65 20 69 6e 73 74 61 | 6e 63 65 20 61 6e 64 20 |he insta|nce and |
|000042f0| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 2e 0d 5c 6f |the func|tion..\o|
|00004300| 62 69 6e 64 65 78 7b 63 | 6c 61 73 73 20 69 6e 73 |bindex{c|lass ins|
|00004310| 74 61 6e 63 65 7d 0d 5c | 6f 62 69 6e 64 65 78 7b |tance}.\|obindex{|
|00004320| 69 6e 73 74 61 6e 63 65 | 7d 0d 5c 69 6e 64 65 78 |instance|}.\index|
|00004330| 69 69 7b 63 6c 61 73 73 | 7d 7b 69 6e 73 74 61 6e |ii{class|}{instan|
|00004340| 63 65 7d 0d 5c 69 6e 64 | 65 78 69 69 7b 63 6c 61 |ce}.\ind|exii{cla|
|00004350| 73 73 20 69 6e 73 74 61 | 6e 63 65 7d 7b 61 74 74 |ss insta|nce}{att|
|00004360| 72 69 62 75 74 65 7d 0d | 0d 41 74 74 72 69 62 75 |ribute}.|.Attribu|
|00004370| 74 65 20 61 73 73 69 67 | 6e 6d 65 6e 74 73 20 75 |te assig|nments u|
|00004380| 70 64 61 74 65 20 74 68 | 65 20 69 6e 73 74 61 6e |pdate th|e instan|
|00004390| 63 65 27 73 20 64 69 63 | 74 69 6f 6e 61 72 79 2e |ce's dic|tionary.|
|000043a0| 0d 5c 69 6e 64 65 78 69 | 69 69 7b 63 6c 61 73 73 |.\indexi|ii{class|
|000043b0| 20 69 6e 73 74 61 6e 63 | 65 7d 7b 61 74 74 72 69 | instanc|e}{attri|
|000043c0| 62 75 74 65 7d 7b 61 73 | 73 69 67 6e 6d 65 6e 74 |bute}{as|signment|
|000043d0| 7d 0d 0d 43 6c 61 73 73 | 20 69 6e 73 74 61 6e 63 |}..Class| instanc|
|000043e0| 65 73 20 63 61 6e 20 70 | 72 65 74 65 6e 64 20 74 |es can p|retend t|
|000043f0| 6f 20 62 65 20 6e 75 6d | 62 65 72 73 2c 20 73 65 |o be num|bers, se|
|00004400| 71 75 65 6e 63 65 73 2c | 20 6f 72 20 6d 61 70 70 |quences,| or mapp|
|00004410| 69 6e 67 73 20 69 66 0d | 74 68 65 79 20 68 61 76 |ings if.|they hav|
|00004420| 65 20 6d 65 74 68 6f 64 | 73 20 77 69 74 68 20 63 |e method|s with c|
|00004430| 65 72 74 61 69 6e 20 73 | 70 65 63 69 61 6c 20 6e |ertain s|pecial n|
|00004440| 61 6d 65 73 2e 20 20 54 | 68 65 73 65 20 61 72 65 |ames. T|hese are|
|00004450| 20 64 65 73 63 72 69 62 | 65 64 20 69 6e 0d 73 65 | describ|ed in.se|
|00004460| 63 74 69 6f 6e 20 5c 72 | 65 66 7b 73 70 65 63 69 |ction \r|ef{speci|
|00004470| 61 6c 6e 61 6d 65 73 7d | 2e 0d 5c 6f 62 69 6e 64 |alnames}|..\obind|
|00004480| 65 78 7b 6e 75 6d 62 65 | 72 7d 0d 5c 6f 62 69 6e |ex{numbe|r}.\obin|
|00004490| 64 65 78 7b 73 65 71 75 | 65 6e 63 65 7d 0d 5c 6f |dex{sequ|ence}.\o|
|000044a0| 62 69 6e 64 65 78 7b 6d | 61 70 70 69 6e 67 7d 0d |bindex{m|apping}.|
|000044b0| 0d 53 70 65 63 69 61 6c | 20 72 65 61 64 2d 6f 6e |.Special| read-on|
|000044c0| 6c 79 20 61 74 74 72 69 | 62 75 74 65 73 3a 20 5c |ly attri|butes: \|
|000044d0| 76 65 72 62 40 5f 5f 64 | 69 63 74 5f 5f 40 20 79 |verb@__d|ict__@ y|
|000044e0| 69 65 6c 64 73 20 74 68 | 65 20 61 74 74 72 69 62 |ields th|e attrib|
|000044f0| 75 74 65 0d 64 69 63 74 | 69 6f 6e 61 72 79 3b 20 |ute.dict|ionary; |
|00004500| 5c 76 65 72 62 40 5f 5f | 63 6c 61 73 73 5f 5f 40 |\verb@__|class__@|
|00004510| 20 79 69 65 6c 64 73 20 | 74 68 65 20 69 6e 73 74 | yields |the inst|
|00004520| 61 6e 63 65 27 73 20 63 | 6c 61 73 73 2e 0d 5c 74 |ance's c|lass..\t|
|00004530| 74 69 6e 64 65 78 7b 5f | 5f 64 69 63 74 5f 5f 7d |tindex{_|_dict__}|
|00004540| 0d 5c 74 74 69 6e 64 65 | 78 7b 5f 5f 63 6c 61 73 |.\ttinde|x{__clas|
|00004550| 73 5f 5f 7d 0d 0d 5c 69 | 74 65 6d 5b 46 69 6c 65 |s__}..\i|tem[File|
|00004560| 73 5d 0d 41 20 66 69 6c | 65 20 6f 62 6a 65 63 74 |s].A fil|e object|
|00004570| 20 72 65 70 72 65 73 65 | 6e 74 73 20 61 6e 20 6f | represe|nts an o|
|00004580| 70 65 6e 20 66 69 6c 65 | 2e 20 20 28 49 74 20 69 |pen file|. (It i|
|00004590| 73 20 61 20 77 72 61 70 | 70 65 72 20 61 72 6f 75 |s a wrap|per arou|
|000045a0| 6e 64 20 61 20 43 0d 7b | 5c 74 74 20 73 74 64 69 |nd a C.{|\tt stdi|
|000045b0| 6f 7d 20 66 69 6c 65 20 | 70 6f 69 6e 74 65 72 2e |o} file |pointer.|
|000045c0| 29 20 20 46 69 6c 65 20 | 6f 62 6a 65 63 74 73 20 |) File |objects |
|000045d0| 61 72 65 20 63 72 65 61 | 74 65 64 20 62 79 20 74 |are crea|ted by t|
|000045e0| 68 65 0d 5c 76 65 72 62 | 40 6f 70 65 6e 28 29 40 |he.\verb|@open()@|
|000045f0| 20 62 75 69 6c 74 2d 69 | 6e 20 66 75 6e 63 74 69 | built-i|n functi|
|00004600| 6f 6e 2c 20 61 6e 64 20 | 61 6c 73 6f 20 62 79 20 |on, and |also by |
|00004610| 5c 76 65 72 62 40 70 6f | 73 69 78 2e 70 6f 70 65 |\verb@po|six.pope|
|00004620| 6e 28 29 40 20 61 6e 64 | 0d 74 68 65 20 5c 76 65 |n()@ and|.the \ve|
|00004630| 72 62 40 6d 61 6b 65 66 | 69 6c 65 40 20 6d 65 74 |rb@makef|ile@ met|
|00004640| 68 6f 64 20 6f 66 20 73 | 6f 63 6b 65 74 20 6f 62 |hod of s|ocket ob|
|00004650| 6a 65 63 74 73 2e 20 20 | 5c 76 65 72 62 40 73 79 |jects. |\verb@sy|
|00004660| 73 2e 73 74 64 69 6e 40 | 2c 0d 5c 76 65 72 62 40 |s.stdin@|,.\verb@|
|00004670| 73 79 73 2e 73 74 64 6f | 75 74 40 20 61 6e 64 20 |sys.stdo|ut@ and |
|00004680| 5c 76 65 72 62 40 73 79 | 73 2e 73 74 64 65 72 72 |\verb@sy|s.stderr|
|00004690| 40 20 61 72 65 20 66 69 | 6c 65 20 6f 62 6a 65 63 |@ are fi|le objec|
|000046a0| 74 73 20 63 6f 72 72 65 | 73 70 6f 6e 64 69 6e 67 |ts corre|sponding|
|000046b0| 0d 74 6f 20 74 68 65 20 | 69 6e 74 65 72 70 72 65 |.to the |interpre|
|000046c0| 74 65 72 27 73 20 73 74 | 61 6e 64 61 72 64 20 69 |ter's st|andard i|
|000046d0| 6e 70 75 74 2c 20 6f 75 | 74 70 75 74 20 61 6e 64 |nput, ou|tput and|
|000046e0| 20 65 72 72 6f 72 20 73 | 74 72 65 61 6d 73 2e 0d | error s|treams..|
|000046f0| 53 65 65 20 74 68 65 20 | 50 79 74 68 6f 6e 20 4c |See the |Python L|
|00004700| 69 62 72 61 72 79 20 52 | 65 66 65 72 65 6e 63 65 |ibrary R|eference|
|00004710| 20 66 6f 72 20 6d 65 74 | 68 6f 64 73 20 6f 66 20 | for met|hods of |
|00004720| 66 69 6c 65 20 6f 62 6a | 65 63 74 73 20 61 6e 64 |file obj|ects and|
|00004730| 20 6f 74 68 65 72 0d 64 | 65 74 61 69 6c 73 2e 0d | other.d|etails..|
|00004740| 5c 6f 62 69 6e 64 65 78 | 7b 66 69 6c 65 7d 0d 5c |\obindex|{file}.\|
|00004750| 69 6e 64 65 78 7b 43 7d | 0d 5c 69 6e 64 65 78 7b |index{C}|.\index{|
|00004760| 73 74 64 69 6f 7d 0d 5c | 62 69 66 75 6e 63 69 6e |stdio}.\|bifuncin|
|00004770| 64 65 78 7b 6f 70 65 6e | 7d 0d 5c 62 69 66 75 6e |dex{open|}.\bifun|
|00004780| 63 69 6e 64 65 78 7b 70 | 6f 70 65 6e 7d 0d 5c 62 |cindex{p|open}.\b|
|00004790| 69 66 75 6e 63 69 6e 64 | 65 78 7b 6d 61 6b 65 66 |ifuncind|ex{makef|
|000047a0| 69 6c 65 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 73 74 |ile}.\tt|index{st|
|000047b0| 64 69 6e 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 73 74 |din}.\tt|index{st|
|000047c0| 64 6f 75 74 7d 0d 5c 74 | 74 69 6e 64 65 78 7b 73 |dout}.\t|tindex{s|
|000047d0| 74 64 65 72 72 7d 0d 5c | 74 74 69 6e 64 65 78 7b |tderr}.\|ttindex{|
|000047e0| 73 79 73 2e 73 74 64 69 | 6e 7d 0d 5c 74 74 69 6e |sys.stdi|n}.\ttin|
|000047f0| 64 65 78 7b 73 79 73 2e | 73 74 64 6f 75 74 7d 0d |dex{sys.|stdout}.|
|00004800| 5c 74 74 69 6e 64 65 78 | 7b 73 79 73 2e 73 74 64 |\ttindex|{sys.std|
|00004810| 65 72 72 7d 0d 0d 5c 69 | 74 65 6d 5b 49 6e 74 65 |err}..\i|tem[Inte|
|00004820| 72 6e 61 6c 20 74 79 70 | 65 73 5d 0d 41 20 66 65 |rnal typ|es].A fe|
|00004830| 77 20 74 79 70 65 73 20 | 75 73 65 64 20 69 6e 74 |w types |used int|
|00004840| 65 72 6e 61 6c 6c 79 20 | 62 79 20 74 68 65 20 69 |ernally |by the i|
|00004850| 6e 74 65 72 70 72 65 74 | 65 72 20 61 72 65 20 65 |nterpret|er are e|
|00004860| 78 70 6f 73 65 64 20 74 | 6f 20 74 68 65 20 75 73 |xposed t|o the us|
|00004870| 65 72 2e 0d 54 68 65 69 | 72 20 64 65 66 69 6e 69 |er..Thei|r defini|
|00004880| 74 69 6f 6e 20 6d 61 79 | 20 63 68 61 6e 67 65 20 |tion may| change |
|00004890| 77 69 74 68 20 66 75 74 | 75 72 65 20 76 65 72 73 |with fut|ure vers|
|000048a0| 69 6f 6e 73 20 6f 66 20 | 74 68 65 20 69 6e 74 65 |ions of |the inte|
|000048b0| 72 70 72 65 74 65 72 2c | 0d 62 75 74 20 74 68 65 |rpreter,|.but the|
|000048c0| 79 20 61 72 65 20 6d 65 | 6e 74 69 6f 6e 65 64 20 |y are me|ntioned |
|000048d0| 68 65 72 65 20 66 6f 72 | 20 63 6f 6d 70 6c 65 74 |here for| complet|
|000048e0| 65 6e 65 73 73 2e 0d 5c | 69 6e 64 65 78 7b 69 6e |eness..\|index{in|
|000048f0| 74 65 72 6e 61 6c 20 74 | 79 70 65 7d 0d 0d 5c 62 |ternal t|ype}..\b|
|00004900| 65 67 69 6e 7b 64 65 73 | 63 72 69 70 74 69 6f 6e |egin{des|cription|
|00004910| 7d 0d 0d 5c 69 74 65 6d | 5b 43 6f 64 65 20 6f 62 |}..\item|[Code ob|
|00004920| 6a 65 63 74 73 5d 0d 43 | 6f 64 65 20 6f 62 6a 65 |jects].C|ode obje|
|00004930| 63 74 73 20 72 65 70 72 | 65 73 65 6e 74 20 60 60 |cts repr|esent ``|
|00004940| 70 73 65 75 64 6f 2d 63 | 6f 6d 70 69 6c 65 64 27 |pseudo-c|ompiled'|
|00004950| 27 20 65 78 65 63 75 74 | 61 62 6c 65 20 50 79 74 |' execut|able Pyt|
|00004960| 68 6f 6e 20 63 6f 64 65 | 2e 0d 54 68 65 20 64 69 |hon code|..The di|
|00004970| 66 66 65 72 65 6e 63 65 | 20 62 65 74 77 65 65 6e |fference| between|
|00004980| 20 61 20 63 6f 64 65 0d | 6f 62 6a 65 63 74 20 61 | a code.|object a|
|00004990| 6e 64 20 61 20 66 75 6e | 63 74 69 6f 6e 20 6f 62 |nd a fun|ction ob|
|000049a0| 6a 65 63 74 20 69 73 20 | 74 68 61 74 20 74 68 65 |ject is |that the|
|000049b0| 20 66 75 6e 63 74 69 6f | 6e 20 6f 62 6a 65 63 74 | functio|n object|
|000049c0| 20 63 6f 6e 74 61 69 6e | 73 20 61 6e 0d 65 78 70 | contain|s an.exp|
|000049d0| 6c 69 63 69 74 20 72 65 | 66 65 72 65 6e 63 65 20 |licit re|ference |
|000049e0| 74 6f 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 27 |to the f|unction'|
|000049f0| 73 20 63 6f 6e 74 65 78 | 74 20 28 74 68 65 20 6d |s contex|t (the m|
|00004a00| 6f 64 75 6c 65 20 69 6e | 20 77 68 69 63 68 20 69 |odule in| which i|
|00004a10| 74 0d 77 61 73 20 64 65 | 66 69 6e 65 64 29 20 77 |t.was de|fined) w|
|00004a20| 68 69 6c 65 20 61 20 63 | 6f 64 65 20 6f 62 6a 65 |hile a c|ode obje|
|00004a30| 63 74 20 63 6f 6e 74 61 | 69 6e 73 20 6e 6f 20 63 |ct conta|ins no c|
|00004a40| 6f 6e 74 65 78 74 2e 0d | 5c 6f 62 69 6e 64 65 78 |ontext..|\obindex|
|00004a50| 7b 63 6f 64 65 7d 0d 0d | 53 70 65 63 69 61 6c 20 |{code}..|Special |
|00004a60| 72 65 61 64 2d 6f 6e 6c | 79 20 61 74 74 72 69 62 |read-onl|y attrib|
|00004a70| 75 74 65 73 3a 20 5c 76 | 65 72 62 40 63 6f 5f 63 |utes: \v|erb@co_c|
|00004a80| 6f 64 65 40 20 69 73 20 | 61 20 73 74 72 69 6e 67 |ode@ is |a string|
|00004a90| 20 72 65 70 72 65 73 65 | 6e 74 69 6e 67 0d 74 68 | represe|nting.th|
|00004aa0| 65 20 73 65 71 75 65 6e | 63 65 20 6f 66 20 69 6e |e sequen|ce of in|
|00004ab0| 73 74 72 75 63 74 69 6f | 6e 73 3b 20 5c 76 65 72 |structio|ns; \ver|
|00004ac0| 62 40 63 6f 5f 63 6f 6e | 73 74 73 40 20 69 73 20 |b@co_con|sts@ is |
|00004ad0| 61 20 6c 69 73 74 20 6f | 66 20 6c 69 74 65 72 61 |a list o|f litera|
|00004ae0| 6c 73 0d 75 73 65 64 20 | 62 79 20 74 68 65 20 63 |ls.used |by the c|
|00004af0| 6f 64 65 3b 20 5c 76 65 | 72 62 40 63 6f 5f 6e 61 |ode; \ve|rb@co_na|
|00004b00| 6d 65 73 40 20 69 73 20 | 61 20 6c 69 73 74 20 6f |mes@ is |a list o|
|00004b10| 66 20 6e 61 6d 65 73 20 | 28 73 74 72 69 6e 67 73 |f names |(strings|
|00004b20| 29 20 75 73 65 64 20 62 | 79 0d 74 68 65 20 63 6f |) used b|y.the co|
|00004b30| 64 65 3b 20 5c 76 65 72 | 62 40 63 6f 5f 66 69 6c |de; \ver|b@co_fil|
|00004b40| 65 6e 61 6d 65 40 20 69 | 73 20 74 68 65 20 66 69 |ename@ i|s the fi|
|00004b50| 6c 65 6e 61 6d 65 20 66 | 72 6f 6d 20 77 68 69 63 |lename f|rom whic|
|00004b60| 68 20 74 68 65 20 63 6f | 64 65 20 77 61 73 0d 63 |h the co|de was.c|
|00004b70| 6f 6d 70 69 6c 65 64 2e | 20 20 28 54 6f 20 66 69 |ompiled.| (To fi|
|00004b80| 6e 64 20 6f 75 74 20 74 | 68 65 20 6c 69 6e 65 20 |nd out t|he line |
|00004b90| 6e 75 6d 62 65 72 73 2c | 20 79 6f 75 20 77 6f 75 |numbers,| you wou|
|00004ba0| 6c 64 20 68 61 76 65 20 | 74 6f 20 64 65 63 6f 64 |ld have |to decod|
|00004bb0| 65 20 74 68 65 0d 69 6e | 73 74 72 75 63 74 69 6f |e the.in|structio|
|00004bc0| 6e 73 3b 20 74 68 65 20 | 73 74 61 6e 64 61 72 64 |ns; the |standard|
|00004bd0| 20 6c 69 62 72 61 72 79 | 20 6d 6f 64 75 6c 65 20 | library| module |
|00004be0| 5c 76 65 72 62 40 64 69 | 73 40 20 63 6f 6e 74 61 |\verb@di|s@ conta|
|00004bf0| 69 6e 73 20 61 6e 0d 65 | 78 61 6d 70 6c 65 20 6f |ins an.e|xample o|
|00004c00| 66 20 68 6f 77 20 74 6f | 20 64 6f 20 74 68 69 73 |f how to| do this|
|00004c10| 2e 29 0d 5c 74 74 69 6e | 64 65 78 7b 63 6f 5f 63 |.).\ttin|dex{co_c|
|00004c20| 6f 64 65 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 63 6f |ode}.\tt|index{co|
|00004c30| 5f 63 6f 6e 73 74 73 7d | 0d 5c 74 74 69 6e 64 65 |_consts}|.\ttinde|
|00004c40| 78 7b 63 6f 5f 6e 61 6d | 65 73 7d 0d 5c 74 74 69 |x{co_nam|es}.\tti|
|00004c50| 6e 64 65 78 7b 63 6f 5f | 66 69 6c 65 6e 61 6d 65 |ndex{co_|filename|
|00004c60| 7d 0d 0d 5c 69 74 65 6d | 5b 46 72 61 6d 65 20 6f |}..\item|[Frame o|
|00004c70| 62 6a 65 63 74 73 5d 0d | 46 72 61 6d 65 20 6f 62 |bjects].|Frame ob|
|00004c80| 6a 65 63 74 73 20 72 65 | 70 72 65 73 65 6e 74 20 |jects re|present |
|00004c90| 65 78 65 63 75 74 69 6f | 6e 20 66 72 61 6d 65 73 |executio|n frames|
|00004ca0| 2e 20 20 54 68 65 79 20 | 6d 61 79 20 6f 63 63 75 |. They |may occu|
|00004cb0| 72 20 69 6e 20 74 72 61 | 63 65 62 61 63 6b 0d 6f |r in tra|ceback.o|
|00004cc0| 62 6a 65 63 74 73 20 28 | 73 65 65 20 62 65 6c 6f |bjects (|see belo|
|00004cd0| 77 29 2e 0d 5c 6f 62 69 | 6e 64 65 78 7b 66 72 61 |w)..\obi|ndex{fra|
|00004ce0| 6d 65 7d 0d 0d 53 70 65 | 63 69 61 6c 20 72 65 61 |me}..Spe|cial rea|
|00004cf0| 64 2d 6f 6e 6c 79 20 61 | 74 74 72 69 62 75 74 65 |d-only a|ttribute|
|00004d00| 73 3a 20 5c 76 65 72 62 | 40 66 5f 62 61 63 6b 40 |s: \verb|@f_back@|
|00004d10| 20 69 73 20 74 6f 20 74 | 68 65 20 70 72 65 76 69 | is to t|he previ|
|00004d20| 6f 75 73 0d 73 74 61 63 | 6b 20 66 72 61 6d 65 20 |ous.stac|k frame |
|00004d30| 28 74 6f 77 61 72 64 73 | 20 74 68 65 20 63 61 6c |(towards| the cal|
|00004d40| 6c 65 72 29 2c 20 6f 72 | 20 5c 76 65 72 62 40 4e |ler), or| \verb@N|
|00004d50| 6f 6e 65 40 20 69 66 20 | 74 68 69 73 20 69 73 20 |one@ if |this is |
|00004d60| 74 68 65 20 62 6f 74 74 | 6f 6d 0d 73 74 61 63 6b |the bott|om.stack|
|00004d70| 20 66 72 61 6d 65 3b 20 | 5c 76 65 72 62 40 66 5f | frame; |\verb@f_|
|00004d80| 63 6f 64 65 40 20 69 73 | 20 74 68 65 20 63 6f 64 |code@ is| the cod|
|00004d90| 65 20 6f 62 6a 65 63 74 | 20 62 65 69 6e 67 20 65 |e object| being e|
|00004da0| 78 65 63 75 74 65 64 20 | 69 6e 20 74 68 69 73 0d |xecuted |in this.|
|00004db0| 66 72 61 6d 65 3b 20 5c | 76 65 72 62 40 66 5f 67 |frame; \|verb@f_g|
|00004dc0| 6c 6f 62 61 6c 73 40 20 | 69 73 20 74 68 65 20 64 |lobals@ |is the d|
|00004dd0| 69 63 74 69 6f 6e 61 72 | 79 20 75 73 65 64 20 74 |ictionar|y used t|
|00004de0| 6f 20 6c 6f 6f 6b 20 75 | 70 20 67 6c 6f 62 61 6c |o look u|p global|
|00004df0| 0d 76 61 72 69 61 62 6c | 65 73 3b 20 5c 76 65 72 |.variabl|es; \ver|
|00004e00| 62 40 66 5f 6c 6f 63 61 | 6c 73 40 20 69 73 20 75 |b@f_loca|ls@ is u|
|00004e10| 73 65 64 20 66 6f 72 20 | 6c 6f 63 61 6c 20 76 61 |sed for |local va|
|00004e20| 72 69 61 62 6c 65 73 3b | 0d 5c 76 65 72 62 40 66 |riables;|.\verb@f|
|00004e30| 5f 6c 69 6e 65 6e 6f 40 | 20 67 69 76 65 73 20 74 |_lineno@| gives t|
|00004e40| 68 65 20 6c 69 6e 65 20 | 6e 75 6d 62 65 72 20 61 |he line |number a|
|00004e50| 6e 64 20 5c 76 65 72 62 | 40 66 5f 6c 61 73 74 69 |nd \verb|@f_lasti|
|00004e60| 40 20 67 69 76 65 73 20 | 74 68 65 0d 70 72 65 63 |@ gives |the.prec|
|00004e70| 69 73 65 20 69 6e 73 74 | 72 75 63 74 69 6f 6e 20 |ise inst|ruction |
|00004e80| 28 74 68 69 73 20 69 73 | 20 61 6e 20 69 6e 64 65 |(this is| an inde|
|00004e90| 78 20 69 6e 74 6f 20 74 | 68 65 20 69 6e 73 74 72 |x into t|he instr|
|00004ea0| 75 63 74 69 6f 6e 20 73 | 74 72 69 6e 67 20 6f 66 |uction s|tring of|
|00004eb0| 0d 74 68 65 20 63 6f 64 | 65 20 6f 62 6a 65 63 74 |.the cod|e object|
|00004ec0| 29 2e 0d 5c 74 74 69 6e | 64 65 78 7b 66 5f 62 61 |)..\ttin|dex{f_ba|
|00004ed0| 63 6b 7d 0d 5c 74 74 69 | 6e 64 65 78 7b 66 5f 63 |ck}.\tti|ndex{f_c|
|00004ee0| 6f 64 65 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 66 5f |ode}.\tt|index{f_|
|00004ef0| 67 6c 6f 62 61 6c 73 7d | 0d 5c 74 74 69 6e 64 65 |globals}|.\ttinde|
|00004f00| 78 7b 66 5f 6c 6f 63 61 | 6c 73 7d 0d 5c 74 74 69 |x{f_loca|ls}.\tti|
|00004f10| 6e 64 65 78 7b 66 5f 6c | 69 6e 65 6e 6f 7d 0d 5c |ndex{f_l|ineno}.\|
|00004f20| 74 74 69 6e 64 65 78 7b | 66 5f 6c 61 73 74 69 7d |ttindex{|f_lasti}|
|00004f30| 0d 0d 5c 69 74 65 6d 5b | 54 72 61 63 65 62 61 63 |..\item[|Tracebac|
|00004f40| 6b 20 6f 62 6a 65 63 74 | 73 5d 20 5c 6c 61 62 65 |k object|s] \labe|
|00004f50| 6c 7b 74 72 61 63 65 62 | 61 63 6b 7d 0d 54 72 61 |l{traceb|ack}.Tra|
|00004f60| 63 65 62 61 63 6b 20 6f | 62 6a 65 63 74 73 20 72 |ceback o|bjects r|
|00004f70| 65 70 72 65 73 65 6e 74 | 20 61 20 73 74 61 63 6b |epresent| a stack|
|00004f80| 20 74 72 61 63 65 20 6f | 66 20 61 6e 20 65 78 63 | trace o|f an exc|
|00004f90| 65 70 74 69 6f 6e 2e 20 | 20 41 0d 74 72 61 63 65 |eption. | A.trace|
|00004fa0| 62 61 63 6b 20 6f 62 6a | 65 63 74 20 69 73 20 63 |back obj|ect is c|
|00004fb0| 72 65 61 74 65 64 20 77 | 68 65 6e 20 61 6e 20 65 |reated w|hen an e|
|00004fc0| 78 63 65 70 74 69 6f 6e | 20 6f 63 63 75 72 73 2e |xception| occurs.|
|00004fd0| 20 20 57 68 65 6e 20 74 | 68 65 20 73 65 61 72 63 | When t|he searc|
|00004fe0| 68 0d 66 6f 72 20 61 6e | 20 65 78 63 65 70 74 69 |h.for an| excepti|
|00004ff0| 6f 6e 20 68 61 6e 64 6c | 65 72 20 75 6e 77 69 6e |on handl|er unwin|
|00005000| 64 73 20 74 68 65 20 65 | 78 65 63 75 74 69 6f 6e |ds the e|xecution|
|00005010| 20 73 74 61 63 6b 2c 20 | 61 74 20 65 61 63 68 20 | stack, |at each |
|00005020| 75 6e 77 6f 75 6e 64 0d | 6c 65 76 65 6c 20 61 20 |unwound.|level a |
|00005030| 74 72 61 63 65 62 61 63 | 6b 20 6f 62 6a 65 63 74 |tracebac|k object|
|00005040| 20 69 73 20 69 6e 73 65 | 72 74 65 64 20 69 6e 20 | is inse|rted in |
|00005050| 66 72 6f 6e 74 20 6f 66 | 20 74 68 65 20 63 75 72 |front of| the cur|
|00005060| 72 65 6e 74 0d 74 72 61 | 63 65 62 61 63 6b 2e 20 |rent.tra|ceback. |
|00005070| 20 57 68 65 6e 20 61 6e | 20 65 78 63 65 70 74 69 | When an| excepti|
|00005080| 6f 6e 20 68 61 6e 64 6c | 65 72 20 69 73 20 65 6e |on handl|er is en|
|00005090| 74 65 72 65 64 0d 28 73 | 65 65 20 61 6c 73 6f 20 |tered.(s|ee also |
|000050a0| 73 65 63 74 69 6f 6e 20 | 5c 72 65 66 7b 74 72 79 |section |\ref{try|
|000050b0| 7d 29 2c 20 74 68 65 20 | 73 74 61 63 6b 20 74 72 |}), the |stack tr|
|000050c0| 61 63 65 20 69 73 0d 6d | 61 64 65 20 61 76 61 69 |ace is.m|ade avai|
|000050d0| 6c 61 62 6c 65 20 74 6f | 20 74 68 65 20 70 72 6f |lable to| the pro|
|000050e0| 67 72 61 6d 20 61 73 20 | 5c 76 65 72 62 40 73 79 |gram as |\verb@sy|
|000050f0| 73 2e 65 78 63 5f 74 72 | 61 63 65 62 61 63 6b 40 |s.exc_tr|aceback@|
|00005100| 2e 20 20 57 68 65 6e 20 | 74 68 65 0d 70 72 6f 67 |. When |the.prog|
|00005110| 72 61 6d 20 63 6f 6e 74 | 61 69 6e 73 20 6e 6f 20 |ram cont|ains no |
|00005120| 73 75 69 74 61 62 6c 65 | 20 68 61 6e 64 6c 65 72 |suitable| handler|
|00005130| 2c 20 74 68 65 20 73 74 | 61 63 6b 20 74 72 61 63 |, the st|ack trac|
|00005140| 65 20 69 73 20 77 72 69 | 74 74 65 6e 0d 28 6e 69 |e is wri|tten.(ni|
|00005150| 63 65 6c 79 20 66 6f 72 | 6d 61 74 74 65 64 29 20 |cely for|matted) |
|00005160| 74 6f 20 74 68 65 20 73 | 74 61 6e 64 61 72 64 20 |to the s|tandard |
|00005170| 65 72 72 6f 72 20 73 74 | 72 65 61 6d 3b 20 69 66 |error st|ream; if|
|00005180| 20 74 68 65 20 69 6e 74 | 65 72 70 72 65 74 65 72 | the int|erpreter|
|00005190| 20 69 73 0d 69 6e 74 65 | 72 61 63 74 69 76 65 2c | is.inte|ractive,|
|000051a0| 20 69 74 20 69 73 20 61 | 6c 73 6f 20 6d 61 64 65 | it is a|lso made|
|000051b0| 20 61 76 61 69 6c 61 62 | 6c 65 20 74 6f 20 74 68 | availab|le to th|
|000051c0| 65 20 75 73 65 72 20 61 | 73 0d 5c 76 65 72 62 40 |e user a|s.\verb@|
|000051d0| 73 79 73 2e 6c 61 73 74 | 5f 74 72 61 63 65 62 61 |sys.last|_traceba|
|000051e0| 63 6b 40 2e 0d 5c 6f 62 | 69 6e 64 65 78 7b 74 72 |ck@..\ob|index{tr|
|000051f0| 61 63 65 62 61 63 6b 7d | 0d 5c 69 6e 64 65 78 69 |aceback}|.\indexi|
|00005200| 69 7b 73 74 61 63 6b 7d | 7b 74 72 61 63 65 7d 0d |i{stack}|{trace}.|
|00005210| 5c 69 6e 64 65 78 69 69 | 7b 65 78 63 65 70 74 69 |\indexii|{excepti|
|00005220| 6f 6e 7d 7b 68 61 6e 64 | 6c 65 72 7d 0d 5c 69 6e |on}{hand|ler}.\in|
|00005230| 64 65 78 69 69 7b 65 78 | 65 63 75 74 69 6f 6e 7d |dexii{ex|ecution}|
|00005240| 7b 73 74 61 63 6b 7d 0d | 5c 74 74 69 6e 64 65 78 |{stack}.|\ttindex|
|00005250| 7b 65 78 63 5f 74 72 61 | 63 65 62 61 63 6b 7d 0d |{exc_tra|ceback}.|
|00005260| 5c 74 74 69 6e 64 65 78 | 7b 6c 61 73 74 5f 74 72 |\ttindex|{last_tr|
|00005270| 61 63 65 62 61 63 6b 7d | 0d 5c 74 74 69 6e 64 65 |aceback}|.\ttinde|
|00005280| 78 7b 73 79 73 2e 65 78 | 63 5f 74 72 61 63 65 62 |x{sys.ex|c_traceb|
|00005290| 61 63 6b 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 73 79 |ack}.\tt|index{sy|
|000052a0| 73 2e 6c 61 73 74 5f 74 | 72 61 63 65 62 61 63 6b |s.last_t|raceback|
|000052b0| 7d 0d 0d 53 70 65 63 69 | 61 6c 20 72 65 61 64 2d |}..Speci|al read-|
|000052c0| 6f 6e 6c 79 20 61 74 74 | 72 69 62 75 74 65 73 3a |only att|ributes:|
|000052d0| 20 5c 76 65 72 62 40 74 | 62 5f 6e 65 78 74 40 20 | \verb@t|b_next@ |
|000052e0| 69 73 20 74 68 65 20 6e | 65 78 74 20 6c 65 76 65 |is the n|ext leve|
|000052f0| 6c 20 69 6e 20 74 68 65 | 0d 73 74 61 63 6b 20 74 |l in the|.stack t|
|00005300| 72 61 63 65 20 28 74 6f | 77 61 72 64 73 20 74 68 |race (to|wards th|
|00005310| 65 20 66 72 61 6d 65 20 | 77 68 65 72 65 20 74 68 |e frame |where th|
|00005320| 65 20 65 78 63 65 70 74 | 69 6f 6e 20 6f 63 63 75 |e except|ion occu|
|00005330| 72 72 65 64 29 2c 20 6f | 72 0d 5c 76 65 72 62 40 |rred), o|r.\verb@|
|00005340| 4e 6f 6e 65 40 20 69 66 | 20 74 68 65 72 65 20 69 |None@ if| there i|
|00005350| 73 20 6e 6f 20 6e 65 78 | 74 20 6c 65 76 65 6c 3b |s no nex|t level;|
|00005360| 20 5c 76 65 72 62 40 74 | 62 5f 66 72 61 6d 65 40 | \verb@t|b_frame@|
|00005370| 20 70 6f 69 6e 74 73 20 | 74 6f 20 74 68 65 0d 65 | points |to the.e|
|00005380| 78 65 63 75 74 69 6f 6e | 20 66 72 61 6d 65 20 6f |xecution| frame o|
|00005390| 66 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 6c 65 |f the cu|rrent le|
|000053a0| 76 65 6c 3b 20 5c 76 65 | 72 62 40 74 62 5f 6c 69 |vel; \ve|rb@tb_li|
|000053b0| 6e 65 6e 6f 40 20 67 69 | 76 65 73 20 74 68 65 20 |neno@ gi|ves the |
|000053c0| 6c 69 6e 65 0d 6e 75 6d | 62 65 72 20 77 68 65 72 |line.num|ber wher|
|000053d0| 65 20 74 68 65 20 65 78 | 63 65 70 74 69 6f 6e 20 |e the ex|ception |
|000053e0| 6f 63 63 75 72 72 65 64 | 3b 20 5c 76 65 72 62 40 |occurred|; \verb@|
|000053f0| 74 62 5f 6c 61 73 74 69 | 40 20 69 6e 64 69 63 61 |tb_lasti|@ indica|
|00005400| 74 65 73 20 74 68 65 0d | 70 72 65 63 69 73 65 20 |tes the.|precise |
|00005410| 69 6e 73 74 72 75 63 74 | 69 6f 6e 2e 20 20 54 68 |instruct|ion. Th|
|00005420| 65 20 6c 69 6e 65 20 6e | 75 6d 62 65 72 20 61 6e |e line n|umber an|
|00005430| 64 20 6c 61 73 74 20 69 | 6e 73 74 72 75 63 74 69 |d last i|nstructi|
|00005440| 6f 6e 20 69 6e 20 74 68 | 65 0d 74 72 61 63 65 62 |on in th|e.traceb|
|00005450| 61 63 6b 20 6d 61 79 20 | 64 69 66 66 65 72 20 66 |ack may |differ f|
|00005460| 72 6f 6d 20 74 68 65 20 | 6c 69 6e 65 20 6e 75 6d |rom the |line num|
|00005470| 62 65 72 20 6f 66 20 69 | 74 73 20 66 72 61 6d 65 |ber of i|ts frame|
|00005480| 20 6f 62 6a 65 63 74 20 | 69 66 20 74 68 65 0d 65 | object |if the.e|
|00005490| 78 63 65 70 74 69 6f 6e | 20 6f 63 63 75 72 72 65 |xception| occurre|
|000054a0| 64 20 69 6e 20 61 20 5c | 76 65 72 62 40 74 72 79 |d in a \|verb@try|
|000054b0| 40 20 73 74 61 74 65 6d | 65 6e 74 20 77 69 74 68 |@ statem|ent with|
|000054c0| 20 6e 6f 20 6d 61 74 63 | 68 69 6e 67 0d 5c 76 65 | no matc|hing.\ve|
|000054d0| 72 62 40 65 78 63 65 70 | 74 40 20 63 6c 61 75 73 |rb@excep|t@ claus|
|000054e0| 65 20 6f 72 20 77 69 74 | 68 20 61 20 5c 76 65 72 |e or wit|h a \ver|
|000054f0| 62 40 66 69 6e 61 6c 6c | 79 40 20 63 6c 61 75 73 |b@finall|y@ claus|
|00005500| 65 2e 0d 5c 74 74 69 6e | 64 65 78 7b 74 62 5f 6e |e..\ttin|dex{tb_n|
|00005510| 65 78 74 7d 0d 5c 74 74 | 69 6e 64 65 78 7b 74 62 |ext}.\tt|index{tb|
|00005520| 5f 66 72 61 6d 65 7d 0d | 5c 74 74 69 6e 64 65 78 |_frame}.|\ttindex|
|00005530| 7b 74 62 5f 6c 69 6e 65 | 6e 6f 7d 0d 5c 74 74 69 |{tb_line|no}.\tti|
|00005540| 6e 64 65 78 7b 74 62 5f | 6c 61 73 74 69 7d 0d 5c |ndex{tb_|lasti}.\|
|00005550| 73 74 69 6e 64 65 78 7b | 74 72 79 7d 0d 0d 5c 65 |stindex{|try}..\e|
|00005560| 6e 64 7b 64 65 73 63 72 | 69 70 74 69 6f 6e 7d 20 |nd{descr|iption} |
|00005570| 25 20 49 6e 74 65 72 6e | 61 6c 20 74 79 70 65 73 |% Intern|al types|
|00005580| 0d 0d 5c 65 6e 64 7b 64 | 65 73 63 72 69 70 74 69 |..\end{d|escripti|
|00005590| 6f 6e 7d 20 25 20 54 79 | 70 65 73 0d 0d 0d 5c 73 |on} % Ty|pes...\s|
|000055a0| 65 63 74 69 6f 6e 7b 53 | 70 65 63 69 61 6c 20 6d |ection{S|pecial m|
|000055b0| 65 74 68 6f 64 20 6e 61 | 6d 65 73 7d 20 5c 6c 61 |ethod na|mes} \la|
|000055c0| 62 65 6c 7b 73 70 65 63 | 69 61 6c 6e 61 6d 65 73 |bel{spec|ialnames|
|000055d0| 7d 0d 0d 41 20 63 6c 61 | 73 73 20 63 61 6e 20 69 |}..A cla|ss can i|
|000055e0| 6d 70 6c 65 6d 65 6e 74 | 20 63 65 72 74 61 69 6e |mplement| certain|
|000055f0| 20 6f 70 65 72 61 74 69 | 6f 6e 73 20 74 68 61 74 | operati|ons that|
|00005600| 20 61 72 65 20 69 6e 76 | 6f 6b 65 64 20 62 79 20 | are inv|oked by |
|00005610| 73 70 65 63 69 61 6c 0d | 73 79 6e 74 61 78 20 28 |special.|syntax (|
|00005620| 73 75 63 68 20 61 73 20 | 73 75 62 73 63 72 69 70 |such as |subscrip|
|00005630| 74 69 6f 6e 20 6f 72 20 | 61 72 69 74 68 6d 65 74 |tion or |arithmet|
|00005640| 69 63 20 6f 70 65 72 61 | 74 69 6f 6e 73 29 20 62 |ic opera|tions) b|
|00005650| 79 20 64 65 66 69 6e 69 | 6e 67 0d 6d 65 74 68 6f |y defini|ng.metho|
|00005660| 64 73 20 77 69 74 68 20 | 73 70 65 63 69 61 6c 20 |ds with |special |
|00005670| 6e 61 6d 65 73 2e 20 20 | 46 6f 72 20 69 6e 73 74 |names. |For inst|
|00005680| 61 6e 63 65 2c 20 69 66 | 20 61 20 63 6c 61 73 73 |ance, if| a class|
|00005690| 20 64 65 66 69 6e 65 73 | 20 61 0d 6d 65 74 68 6f | defines| a.metho|
|000056a0| 64 20 6e 61 6d 65 64 20 | 5c 76 65 72 62 40 5f 5f |d named |\verb@__|
|000056b0| 67 65 74 69 74 65 6d 5f | 5f 40 2c 20 61 6e 64 20 |getitem_|_@, and |
|000056c0| 5c 76 65 72 62 40 78 40 | 20 69 73 20 61 6e 20 69 |\verb@x@| is an i|
|000056d0| 6e 73 74 61 6e 63 65 20 | 6f 66 20 74 68 69 73 0d |nstance |of this.|
|000056e0| 63 6c 61 73 73 2c 20 74 | 68 65 6e 20 5c 76 65 72 |class, t|hen \ver|
|000056f0| 62 40 78 5b 69 5d 40 20 | 69 73 20 65 71 75 69 76 |b@x[i]@ |is equiv|
|00005700| 61 6c 65 6e 74 20 74 6f | 20 5c 76 65 72 62 40 78 |alent to| \verb@x|
|00005710| 2e 5f 5f 67 65 74 69 74 | 65 6d 5f 5f 28 69 29 40 |.__getit|em__(i)@|
|00005720| 2e 0d 28 54 68 65 20 72 | 65 76 65 72 73 65 20 69 |..(The r|everse i|
|00005730| 73 20 6e 6f 74 20 74 72 | 75 65 20 2d 2d 2d 20 69 |s not tr|ue --- i|
|00005740| 66 20 5c 76 65 72 62 40 | 78 40 20 69 73 20 61 20 |f \verb@|x@ is a |
|00005750| 6c 69 73 74 20 6f 62 6a | 65 63 74 2c 0d 5c 76 65 |list obj|ect,.\ve|
|00005760| 72 62 40 78 2e 5f 5f 67 | 65 74 69 74 65 6d 5f 5f |rb@x.__g|etitem__|
|00005770| 28 69 29 40 20 69 73 20 | 6e 6f 74 20 65 71 75 69 |(i)@ is |not equi|
|00005780| 76 61 6c 65 6e 74 20 74 | 6f 20 5c 76 65 72 62 40 |valent t|o \verb@|
|00005790| 78 5b 69 5d 40 2e 29 0d | 5c 74 74 69 6e 64 65 78 |x[i]@.).|\ttindex|
|000057a0| 7b 5f 5f 67 65 74 69 74 | 65 6d 5f 5f 7d 0d 0d 45 |{__getit|em__}..E|
|000057b0| 78 63 65 70 74 20 66 6f | 72 20 5c 76 65 72 62 40 |xcept fo|r \verb@|
|000057c0| 5f 5f 72 65 70 72 5f 5f | 40 2c 20 5c 76 65 72 62 |__repr__|@, \verb|
|000057d0| 40 5f 5f 73 74 72 5f 5f | 40 20 61 6e 64 20 5c 76 |@__str__|@ and \v|
|000057e0| 65 72 62 40 5f 5f 63 6d | 70 5f 5f 40 2c 0d 61 74 |erb@__cm|p__@,.at|
|000057f0| 74 65 6d 70 74 73 20 74 | 6f 20 65 78 65 63 75 74 |tempts t|o execut|
|00005800| 65 20 61 6e 0d 6f 70 65 | 72 61 74 69 6f 6e 20 72 |e an.ope|ration r|
|00005810| 61 69 73 65 20 61 6e 20 | 65 78 63 65 70 74 69 6f |aise an |exceptio|
|00005820| 6e 20 77 68 65 6e 20 6e | 6f 20 61 70 70 72 6f 70 |n when n|o approp|
|00005830| 72 69 61 74 65 20 6d 65 | 74 68 6f 64 20 69 73 20 |riate me|thod is |
|00005840| 64 65 66 69 6e 65 64 2e | 0d 46 6f 72 20 5c 76 65 |defined.|.For \ve|
|00005850| 72 62 40 5f 5f 72 65 70 | 72 5f 5f 40 2c 20 74 68 |rb@__rep|r__@, th|
|00005860| 65 20 64 65 66 61 75 6c | 74 20 69 73 20 74 6f 20 |e defaul|t is to |
|00005870| 72 65 74 75 72 6e 20 61 | 20 73 74 72 69 6e 67 20 |return a| string |
|00005880| 64 65 73 63 72 69 62 69 | 6e 67 20 74 68 65 0d 6f |describi|ng the.o|
|00005890| 62 6a 65 63 74 27 73 20 | 63 6c 61 73 73 20 61 6e |bject's |class an|
|000058a0| 64 20 61 64 64 72 65 73 | 73 2e 0d 46 6f 72 20 5c |d addres|s..For \|
|000058b0| 76 65 72 62 40 5f 5f 63 | 6d 70 5f 5f 40 2c 20 74 |verb@__c|mp__@, t|
|000058c0| 68 65 20 64 65 66 61 75 | 6c 74 20 69 73 20 74 6f |he defau|lt is to|
|000058d0| 20 63 6f 6d 70 61 72 65 | 20 69 6e 73 74 61 6e 63 | compare| instanc|
|000058e0| 65 73 20 62 61 73 65 64 | 20 6f 6e 20 74 68 65 69 |es based| on thei|
|000058f0| 72 0d 61 64 64 72 65 73 | 73 2e 0d 46 6f 72 20 5c |r.addres|s..For \|
|00005900| 76 65 72 62 40 5f 5f 73 | 74 72 5f 5f 40 2c 20 74 |verb@__s|tr__@, t|
|00005910| 68 65 20 64 65 66 61 75 | 6c 74 20 69 73 20 74 6f |he defau|lt is to|
|00005920| 20 75 73 65 20 5c 76 65 | 72 62 40 5f 5f 72 65 70 | use \ve|rb@__rep|
|00005930| 72 5f 5f 40 2e 0d 5c 74 | 74 69 6e 64 65 78 7b 5f |r__@..\t|tindex{_|
|00005940| 5f 72 65 70 72 5f 5f 7d | 0d 5c 74 74 69 6e 64 65 |_repr__}|.\ttinde|
|00005950| 78 7b 5f 5f 73 74 72 5f | 5f 7d 0d 5c 74 74 69 6e |x{__str_|_}.\ttin|
|00005960| 64 65 78 7b 5f 5f 63 6d | 70 5f 5f 7d 0d 0d 0d 5c |dex{__cm|p__}...\|
|00005970| 73 75 62 73 65 63 74 69 | 6f 6e 7b 53 70 65 63 69 |subsecti|on{Speci|
|00005980| 61 6c 20 6d 65 74 68 6f | 64 73 20 66 6f 72 20 61 |al metho|ds for a|
|00005990| 6e 79 20 74 79 70 65 7d | 0d 0d 5c 62 65 67 69 6e |ny type}|..\begin|
|000059a0| 7b 64 65 73 63 72 69 70 | 74 69 6f 6e 7d 0d 0d 5c |{descrip|tion}..\|
|000059b0| 69 74 65 6d 5b 7b 5c 74 | 74 20 5f 5f 69 6e 69 74 |item[{\t|t __init|
|000059c0| 5f 5f 28 73 65 6c 66 2c | 20 61 72 67 73 2e 2e 2e |__(self,| args...|
|000059d0| 29 7d 5d 0d 43 61 6c 6c | 65 64 20 77 68 65 6e 20 |)}].Call|ed when |
|000059e0| 74 68 65 20 69 6e 73 74 | 61 6e 63 65 20 69 73 20 |the inst|ance is |
|000059f0| 63 72 65 61 74 65 64 2e | 20 20 54 68 65 20 61 72 |created.| The ar|
|00005a00| 67 75 6d 65 6e 74 73 20 | 61 72 65 20 74 68 6f 73 |guments |are thos|
|00005a10| 65 20 70 61 73 73 65 64 | 0d 74 6f 20 74 68 65 20 |e passed|.to the |
|00005a20| 63 6c 61 73 73 20 63 6f | 6e 73 74 72 75 63 74 6f |class co|nstructo|
|00005a30| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 20 49 |r expres|sion. I|
|00005a40| 66 20 61 20 62 61 73 65 | 20 63 6c 61 73 73 20 68 |f a base| class h|
|00005a50| 61 73 20 61 6e 0d 5c 63 | 6f 64 65 7b 5f 5f 69 6e |as an.\c|ode{__in|
|00005a60| 69 74 5f 5f 7d 20 6d 65 | 74 68 6f 64 20 74 68 65 |it__} me|thod the|
|00005a70| 20 64 65 72 69 76 65 64 | 20 63 6c 61 73 73 27 73 | derived| class's|
|00005a80| 20 5c 63 6f 64 65 7b 5f | 5f 69 6e 69 74 5f 5f 7d | \code{_|_init__}|
|00005a90| 20 6d 65 74 68 6f 64 20 | 6d 75 73 74 0d 65 78 70 | method |must.exp|
|00005aa0| 6c 69 63 69 74 6c 79 20 | 63 61 6c 6c 20 69 74 20 |licitly |call it |
|00005ab0| 74 6f 20 65 6e 73 75 72 | 65 20 70 72 6f 70 65 72 |to ensur|e proper|
|00005ac0| 20 69 6e 69 74 69 61 6c | 69 7a 61 74 69 6f 6e 20 | initial|ization |
|00005ad0| 6f 66 20 74 68 65 20 62 | 61 73 65 20 63 6c 61 73 |of the b|ase clas|
|00005ae0| 73 0d 70 61 72 74 20 6f | 66 20 74 68 65 20 69 6e |s.part o|f the in|
|00005af0| 73 74 61 6e 63 65 2e 0d | 5c 74 74 69 6e 64 65 78 |stance..|\ttindex|
|00005b00| 7b 5f 5f 69 6e 69 74 5f | 5f 7d 0d 5c 69 6e 64 65 |{__init_|_}.\inde|
|00005b10| 78 69 69 7b 63 6c 61 73 | 73 7d 7b 63 6f 6e 73 74 |xii{clas|s}{const|
|00005b20| 72 75 63 74 6f 72 7d 0d | 0d 0d 5c 69 74 65 6d 5b |ructor}.|..\item[|
|00005b30| 7b 5c 74 74 20 5f 5f 64 | 65 6c 5f 5f 28 73 65 6c |{\tt __d|el__(sel|
|00005b40| 66 29 7d 5d 0d 43 61 6c | 6c 65 64 20 77 68 65 6e |f)}].Cal|led when|
|00005b50| 20 74 68 65 20 69 6e 73 | 74 61 6e 63 65 20 69 73 | the ins|tance is|
|00005b60| 20 61 62 6f 75 74 20 74 | 6f 20 62 65 20 64 65 73 | about t|o be des|
|00005b70| 74 72 6f 79 65 64 2e 20 | 20 49 66 20 61 20 62 61 |troyed. | If a ba|
|00005b80| 73 65 20 63 6c 61 73 73 | 0d 68 61 73 20 61 6e 20 |se class|.has an |
|00005b90| 5c 63 6f 64 65 7b 5f 5f | 64 65 6c 5f 5f 7d 20 6d |\code{__|del__} m|
|00005ba0| 65 74 68 6f 64 20 74 68 | 65 20 64 65 72 69 76 65 |ethod th|e derive|
|00005bb0| 64 20 63 6c 61 73 73 27 | 73 20 5c 63 6f 64 65 7b |d class'|s \code{|
|00005bc0| 5f 5f 64 65 6c 5f 5f 7d | 20 6d 65 74 68 6f 64 0d |__del__}| method.|
|00005bd0| 6d 75 73 74 20 65 78 70 | 6c 69 63 69 74 6c 79 20 |must exp|licitly |
|00005be0| 63 61 6c 6c 20 69 74 20 | 74 6f 20 65 6e 73 75 72 |call it |to ensur|
|00005bf0| 65 20 70 72 6f 70 65 72 | 20 64 65 6c 65 74 69 6f |e proper| deletio|
|00005c00| 6e 20 6f 66 20 74 68 65 | 20 62 61 73 65 20 63 6c |n of the| base cl|
|00005c10| 61 73 73 0d 70 61 72 74 | 20 6f 66 20 74 68 65 20 |ass.part| of the |
|00005c20| 69 6e 73 74 61 6e 63 65 | 2e 20 20 4e 6f 74 65 20 |instance|. Note |
|00005c30| 74 68 61 74 20 69 74 20 | 69 73 20 70 6f 73 73 69 |that it |is possi|
|00005c40| 62 6c 65 20 66 6f 72 20 | 74 68 65 20 5c 63 6f 64 |ble for |the \cod|
|00005c50| 65 7b 5f 5f 64 65 6c 5f | 5f 7d 0d 6d 65 74 68 6f |e{__del_|_}.metho|
|00005c60| 64 20 74 6f 20 70 6f 73 | 74 70 6f 6e 65 20 64 65 |d to pos|tpone de|
|00005c70| 73 74 72 75 63 74 69 6f | 6e 20 6f 66 20 74 68 65 |structio|n of the|
|00005c80| 20 69 6e 73 74 61 6e 63 | 65 20 62 79 20 63 72 65 | instanc|e by cre|
|00005c90| 61 74 69 6e 67 20 61 20 | 6e 65 77 0d 72 65 66 65 |ating a |new.refe|
|00005ca0| 72 65 6e 63 65 20 74 6f | 20 69 74 2e 20 20 49 74 |rence to| it. It|
|00005cb0| 20 6d 61 79 20 74 68 65 | 6e 20 62 65 20 63 61 6c | may the|n be cal|
|00005cc0| 6c 65 64 20 61 74 20 61 | 20 6c 61 74 65 72 20 74 |led at a| later t|
|00005cd0| 69 6d 65 20 77 68 65 6e | 20 74 68 69 73 20 6e 65 |ime when| this ne|
|00005ce0| 77 0d 72 65 66 65 72 65 | 6e 63 65 20 69 73 20 64 |w.refere|nce is d|
|00005cf0| 65 6c 65 74 65 64 2e 20 | 20 49 74 20 69 73 20 6e |eleted. | It is n|
|00005d00| 6f 74 20 67 75 61 72 61 | 6e 74 65 65 64 20 74 68 |ot guara|nteed th|
|00005d10| 61 74 0d 5c 63 6f 64 65 | 7b 5f 5f 64 65 6c 5f 5f |at.\code|{__del__|
|00005d20| 7d 20 6d 65 74 68 6f 64 | 73 20 61 72 65 20 63 61 |} method|s are ca|
|00005d30| 6c 6c 65 64 20 66 6f 72 | 20 6f 62 6a 65 63 74 73 |lled for| objects|
|00005d40| 20 74 68 61 74 20 73 74 | 69 6c 6c 20 65 78 69 73 | that st|ill exis|
|00005d50| 74 20 77 68 65 6e 0d 74 | 68 65 20 69 6e 74 65 72 |t when.t|he inter|
|00005d60| 70 72 65 74 65 72 20 65 | 78 69 74 73 2e 0d 5c 74 |preter e|xits..\t|
|00005d70| 74 69 6e 64 65 78 7b 5f | 5f 64 65 6c 5f 5f 7d 0d |tindex{_|_del__}.|
|00005d80| 5c 73 74 69 6e 64 65 78 | 7b 64 65 6c 7d 0d 0d 4e |\stindex|{del}..N|
|00005d90| 6f 74 65 20 74 68 61 74 | 20 5c 63 6f 64 65 7b 64 |ote that| \code{d|
|00005da0| 65 6c 20 78 7d 20 64 6f | 65 73 6e 27 74 20 64 69 |el x} do|esn't di|
|00005db0| 72 65 63 74 6c 79 20 63 | 61 6c 6c 20 5c 63 6f 64 |rectly c|all \cod|
|00005dc0| 65 7b 78 2e 5f 5f 64 65 | 6c 5f 5f 7d 20 2d 2d 2d |e{x.__de|l__} ---|
|00005dd0| 20 74 68 65 0d 66 6f 72 | 6d 65 72 20 64 65 63 72 | the.for|mer decr|
|00005de0| 65 6d 65 6e 74 73 20 74 | 68 65 20 72 65 66 65 72 |ements t|he refer|
|00005df0| 65 6e 63 65 20 63 6f 75 | 6e 74 20 66 6f 72 20 5c |ence cou|nt for \|
|00005e00| 63 6f 64 65 7b 78 7d 20 | 62 79 20 6f 6e 65 2c 20 |code{x} |by one, |
|00005e10| 62 75 74 0d 5c 63 6f 64 | 65 7b 78 2e 5f 5f 64 65 |but.\cod|e{x.__de|
|00005e20| 6c 5f 5f 7d 20 69 73 20 | 6f 6e 6c 79 20 63 61 6c |l__} is |only cal|
|00005e30| 6c 65 64 20 77 68 65 6e | 20 69 74 73 20 72 65 66 |led when| its ref|
|00005e40| 65 72 65 6e 63 65 20 63 | 6f 75 6e 74 20 72 65 61 |erence c|ount rea|
|00005e50| 63 68 65 73 20 7a 65 72 | 6f 2e 0d 0d 5c 69 74 65 |ches zer|o...\ite|
|00005e60| 6d 5b 7b 5c 74 74 20 5f | 5f 72 65 70 72 5f 5f 28 |m[{\tt _|_repr__(|
|00005e70| 73 65 6c 66 29 7d 5d 0d | 43 61 6c 6c 65 64 20 62 |self)}].|Called b|
|00005e80| 79 20 74 68 65 20 5c 76 | 65 72 62 40 72 65 70 72 |y the \v|erb@repr|
|00005e90| 28 29 40 20 62 75 69 6c | 74 2d 69 6e 20 66 75 6e |()@ buil|t-in fun|
|00005ea0| 63 74 69 6f 6e 20 61 6e | 64 20 62 79 20 73 74 72 |ction an|d by str|
|00005eb0| 69 6e 67 20 63 6f 6e 76 | 65 72 73 69 6f 6e 73 0d |ing conv|ersions.|
|00005ec0| 28 72 65 76 65 72 73 65 | 20 6f 72 20 62 61 63 6b |(reverse| or back|
|00005ed0| 77 61 72 64 20 71 75 6f | 74 65 73 29 20 74 6f 20 |ward quo|tes) to |
|00005ee0| 63 6f 6d 70 75 74 65 20 | 74 68 65 20 73 74 72 69 |compute |the stri|
|00005ef0| 6e 67 20 72 65 70 72 65 | 73 65 6e 74 61 74 69 6f |ng repre|sentatio|
|00005f00| 6e 20 6f 66 20 61 6e 20 | 6f 62 6a 65 63 74 2e 0d |n of an |object..|
|00005f10| 5c 74 74 69 6e 64 65 78 | 7b 5f 5f 72 65 70 72 5f |\ttindex|{__repr_|
|00005f20| 5f 7d 0d 5c 62 69 66 75 | 6e 63 69 6e 64 65 78 7b |_}.\bifu|ncindex{|
|00005f30| 72 65 70 72 7d 0d 5c 69 | 6e 64 65 78 69 69 7b 73 |repr}.\i|ndexii{s|
|00005f40| 74 72 69 6e 67 7d 7b 63 | 6f 6e 76 65 72 73 69 6f |tring}{c|onversio|
|00005f50| 6e 7d 0d 5c 69 6e 64 65 | 78 69 69 7b 72 65 76 65 |n}.\inde|xii{reve|
|00005f60| 72 73 65 7d 7b 71 75 6f | 74 65 73 7d 0d 5c 69 6e |rse}{quo|tes}.\in|
|00005f70| 64 65 78 69 69 7b 62 61 | 63 6b 77 61 72 64 7d 7b |dexii{ba|ckward}{|
|00005f80| 71 75 6f 74 65 73 7d 0d | 5c 69 6e 64 65 78 7b 62 |quotes}.|\index{b|
|00005f90| 61 63 6b 2d 71 75 6f 74 | 65 73 7d 0d 0d 5c 69 74 |ack-quot|es}..\it|
|00005fa0| 65 6d 5b 7b 5c 74 74 20 | 5f 5f 73 74 72 5f 5f 28 |em[{\tt |__str__(|
|00005fb0| 73 65 6c 66 29 7d 5d 0d | 43 61 6c 6c 65 64 20 62 |self)}].|Called b|
|00005fc0| 79 20 74 68 65 20 5c 76 | 65 72 62 40 73 74 72 28 |y the \v|erb@str(|
|00005fd0| 29 40 20 62 75 69 6c 74 | 2d 69 6e 20 66 75 6e 63 |)@ built|-in func|
|00005fe0| 74 69 6f 6e 20 61 6e 64 | 20 62 79 20 74 68 65 20 |tion and| by the |
|00005ff0| 5c 76 65 72 62 40 70 72 | 69 6e 74 40 0d 73 74 61 |\verb@pr|int@.sta|
|00006000| 74 65 6d 65 6e 74 20 63 | 6f 6d 70 75 74 65 20 74 |tement c|ompute t|
|00006010| 68 65 20 73 74 72 69 6e | 67 20 72 65 70 72 65 73 |he strin|g repres|
|00006020| 65 6e 74 61 74 69 6f 6e | 20 6f 66 20 61 6e 20 6f |entation| of an o|
|00006030| 62 6a 65 63 74 2e 0d 5c | 74 74 69 6e 64 65 78 7b |bject..\|ttindex{|
|00006040| 5f 5f 73 74 72 5f 5f 7d | 0d 5c 62 69 66 75 6e 63 |__str__}|.\bifunc|
|00006050| 69 6e 64 65 78 7b 73 74 | 72 7d 0d 5c 73 74 69 6e |index{st|r}.\stin|
|00006060| 64 65 78 7b 70 72 69 6e | 74 7d 0d 0d 5c 69 74 65 |dex{prin|t}..\ite|
|00006070| 6d 5b 7b 5c 74 74 20 5f | 5f 63 6d 70 5f 5f 28 73 |m[{\tt _|_cmp__(s|
|00006080| 65 6c 66 2c 20 6f 74 68 | 65 72 29 7d 5d 0d 43 61 |elf, oth|er)}].Ca|
|00006090| 6c 6c 65 64 20 62 79 20 | 61 6c 6c 20 63 6f 6d 70 |lled by |all comp|
|000060a0| 61 72 69 73 6f 6e 20 6f | 70 65 72 61 74 69 6f 6e |arison o|peration|
|000060b0| 73 2e 20 20 53 68 6f 75 | 6c 64 20 72 65 74 75 72 |s. Shou|ld retur|
|000060c0| 6e 20 2d 31 20 69 66 0d | 5c 76 65 72 62 40 73 65 |n -1 if.|\verb@se|
|000060d0| 6c 66 20 3c 20 6f 74 68 | 65 72 40 2c 20 20 30 20 |lf < oth|er@, 0 |
|000060e0| 69 66 20 5c 76 65 72 62 | 40 73 65 6c 66 20 3d 3d |if \verb|@self ==|
|000060f0| 20 6f 74 68 65 72 40 2c | 20 2b 31 20 69 66 0d 5c | other@,| +1 if.\|
|00006100| 76 65 72 62 40 73 65 6c | 66 20 3e 20 6f 74 68 65 |verb@sel|f > othe|
|00006110| 72 40 2e 20 20 49 66 20 | 6e 6f 20 5c 63 6f 64 65 |r@. If |no \code|
|00006120| 7b 5f 5f 63 6d 70 5f 5f | 7d 20 6f 70 65 72 61 74 |{__cmp__|} operat|
|00006130| 69 6f 6e 20 69 73 20 64 | 65 66 69 6e 65 64 2c 20 |ion is d|efined, |
|00006140| 63 6c 61 73 73 0d 69 6e | 73 74 61 6e 63 65 73 20 |class.in|stances |
|00006150| 61 72 65 20 63 6f 6d 70 | 61 72 65 64 20 62 79 20 |are comp|ared by |
|00006160| 6f 62 6a 65 63 74 20 69 | 64 65 6e 74 69 74 79 20 |object i|dentity |
|00006170| 28 60 60 61 64 64 72 65 | 73 73 27 27 29 2e 0d 28 |(``addre|ss'')..(|
|00006180| 49 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 6e |Implemen|tation n|
|00006190| 6f 74 65 3a 20 64 75 65 | 20 74 6f 20 6c 69 6d 69 |ote: due| to limi|
|000061a0| 74 61 74 69 6f 6e 73 20 | 69 6e 20 74 68 65 20 69 |tations |in the i|
|000061b0| 6e 74 65 72 70 72 65 74 | 65 72 2c 0d 65 78 63 65 |nterpret|er,.exce|
|000061c0| 70 74 69 6f 6e 73 20 72 | 61 69 73 65 64 20 62 79 |ptions r|aised by|
|000061d0| 20 63 6f 6d 70 61 72 69 | 73 6f 6e 73 20 61 72 65 | compari|sons are|
|000061e0| 20 69 67 6e 6f 72 65 64 | 2c 20 61 6e 64 20 74 68 | ignored|, and th|
|000061f0| 65 20 6f 62 6a 65 63 74 | 73 20 77 69 6c 6c 20 62 |e object|s will b|
|00006200| 65 0d 63 6f 6e 73 69 64 | 65 72 65 64 20 65 71 75 |e.consid|ered equ|
|00006210| 61 6c 20 69 6e 20 74 68 | 69 73 20 63 61 73 65 2e |al in th|is case.|
|00006220| 29 0d 5c 74 74 69 6e 64 | 65 78 7b 5f 5f 63 6d 70 |).\ttind|ex{__cmp|
|00006230| 5f 5f 7d 0d 5c 62 69 66 | 75 6e 63 69 6e 64 65 78 |__}.\bif|uncindex|
|00006240| 7b 63 6d 70 7d 0d 5c 69 | 6e 64 65 78 7b 63 6f 6d |{cmp}.\i|ndex{com|
|00006250| 70 61 72 69 73 6f 6e 73 | 7d 0d 0d 5c 69 74 65 6d |parisons|}..\item|
|00006260| 5b 7b 5c 74 74 20 5f 5f | 68 61 73 68 5f 5f 28 73 |[{\tt __|hash__(s|
|00006270| 65 6c 66 29 7d 5d 0d 43 | 61 6c 6c 65 64 20 66 6f |elf)}].C|alled fo|
|00006280| 72 20 74 68 65 20 6b 65 | 79 20 6f 62 6a 65 63 74 |r the ke|y object|
|00006290| 20 66 6f 72 20 64 69 63 | 74 69 6f 6e 61 72 79 20 | for dic|tionary |
|000062a0| 6f 70 65 72 61 74 69 6f | 6e 73 2c 0d 61 6e 64 20 |operatio|ns,.and |
|000062b0| 62 79 20 74 68 65 20 62 | 75 69 6c 74 2d 69 6e 20 |by the b|uilt-in |
|000062c0| 66 75 6e 63 74 69 6f 6e | 0d 5c 63 6f 64 65 7b 68 |function|.\code{h|
|000062d0| 61 73 68 28 29 7d 2e 20 | 20 53 68 6f 75 6c 64 20 |ash()}. | Should |
|000062e0| 72 65 74 75 72 6e 20 61 | 20 33 32 2d 62 69 74 20 |return a| 32-bit |
|000062f0| 69 6e 74 65 67 65 72 20 | 75 73 61 62 6c 65 20 61 |integer |usable a|
|00006300| 73 20 61 20 68 61 73 68 | 20 76 61 6c 75 65 0d 66 |s a hash| value.f|
|00006310| 6f 72 20 64 69 63 74 69 | 6f 6e 61 72 79 20 6f 70 |or dicti|onary op|
|00006320| 65 72 61 74 69 6f 6e 73 | 2e 20 20 54 68 65 20 6f |erations|. The o|
|00006330| 6e 6c 79 20 72 65 71 75 | 69 72 65 64 20 70 72 6f |nly requ|ired pro|
|00006340| 70 65 72 74 79 20 69 73 | 20 74 68 61 74 20 6f 62 |perty is| that ob|
|00006350| 6a 65 63 74 73 0d 77 68 | 69 63 68 20 63 6f 6d 70 |jects.wh|ich comp|
|00006360| 61 72 65 20 65 71 75 61 | 6c 20 68 61 76 65 20 74 |are equa|l have t|
|00006370| 68 65 20 73 61 6d 65 20 | 68 61 73 68 20 76 61 6c |he same |hash val|
|00006380| 75 65 3b 20 69 74 20 69 | 73 20 61 64 76 69 73 65 |ue; it i|s advise|
|00006390| 64 20 74 6f 20 73 6f 6d | 65 68 6f 77 0d 6d 69 78 |d to som|ehow.mix|
|000063a0| 20 74 6f 67 65 74 68 65 | 72 20 28 65 2e 67 2e 20 | togethe|r (e.g. |
|000063b0| 75 73 69 6e 67 20 65 78 | 63 6c 75 73 69 76 65 20 |using ex|clusive |
|000063c0| 6f 72 29 20 74 68 65 20 | 68 61 73 68 20 76 61 6c |or) the |hash val|
|000063d0| 75 65 73 20 66 6f 72 20 | 74 68 65 0d 63 6f 6d 70 |ues for |the.comp|
|000063e0| 6f 6e 65 6e 74 73 20 6f | 66 20 74 68 65 20 6f 62 |onents o|f the ob|
|000063f0| 6a 65 63 74 20 74 68 61 | 74 20 61 6c 73 6f 20 70 |ject tha|t also p|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.