home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / python / pytex / pytexdoc / lib1 / select / tex
LaTeX Document  |  1996-11-08  |  1.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
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 default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 73 65 63 74 69 6f 6e | 7b 42 75 69 6c 74 2d 69 |\section|{Built-i|
|00000010| 6e 20 4d 6f 64 75 6c 65 | 20 5c 73 65 63 74 63 6f |n Module| \sectco|
|00000020| 64 65 7b 73 65 6c 65 63 | 74 7d 7d 0a 5c 62 69 6d |de{selec|t}}.\bim|
|00000030| 6f 64 69 6e 64 65 78 7b | 73 65 6c 65 63 74 7d 0a |odindex{|select}.|
|00000040| 0a 54 68 69 73 20 6d 6f | 64 75 6c 65 20 70 72 6f |.This mo|dule pro|
|00000050| 76 69 64 65 73 20 61 63 | 63 65 73 73 20 74 6f 20 |vides ac|cess to |
|00000060| 74 68 65 20 66 75 6e 63 | 74 69 6f 6e 20 5c 63 6f |the func|tion \co|
|00000070| 64 65 7b 73 65 6c 65 63 | 74 7d 20 61 76 61 69 6c |de{selec|t} avail|
|00000080| 61 62 6c 65 20 69 6e 0a | 6d 6f 73 74 20 5c 55 4e |able in.|most \UN|
|00000090| 49 58 7b 7d 20 76 65 72 | 73 69 6f 6e 73 2e 20 20 |IX{} ver|sions. |
|000000a0| 49 74 20 64 65 66 69 6e | 65 73 20 74 68 65 20 66 |It defin|es the f|
|000000b0| 6f 6c 6c 6f 77 69 6e 67 | 3a 0a 0a 5c 72 65 6e 65 |ollowing|:..\rene|
|000000c0| 77 63 6f 6d 6d 61 6e 64 | 7b 5c 69 6e 64 65 78 73 |wcommand|{\indexs|
|000000d0| 75 62 69 74 65 6d 7d 7b | 28 69 6e 20 6d 6f 64 75 |ubitem}{|(in modu|
|000000e0| 6c 65 20 73 65 6c 65 63 | 74 29 7d 0a 5c 62 65 67 |le selec|t)}.\beg|
|000000f0| 69 6e 7b 65 78 63 64 65 | 73 63 7d 7b 65 72 72 6f |in{excde|sc}{erro|
|00000100| 72 7d 0a 54 68 65 20 65 | 78 63 65 70 74 69 6f 6e |r}.The e|xception|
|00000110| 20 72 61 69 73 65 64 20 | 77 68 65 6e 20 61 6e 20 | raised |when an |
|00000120| 65 72 72 6f 72 20 6f 63 | 63 75 72 73 2e 20 20 54 |error oc|curs. T|
|00000130| 68 65 20 61 63 63 6f 6d | 70 61 6e 79 69 6e 67 20 |he accom|panying |
|00000140| 76 61 6c 75 65 20 69 73 | 0a 61 20 70 61 69 72 20 |value is|.a pair |
|00000150| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 74 68 65 20 6e |containi|ng the n|
|00000160| 75 6d 65 72 69 63 20 65 | 72 72 6f 72 20 63 6f 64 |umeric e|rror cod|
|00000170| 65 20 66 72 6f 6d 20 5c | 63 6f 64 65 7b 65 72 72 |e from \|code{err|
|00000180| 6e 6f 7d 20 61 6e 64 20 | 74 68 65 0a 63 6f 72 72 |no} and |the.corr|
|00000190| 65 73 70 6f 6e 64 69 6e | 67 20 73 74 72 69 6e 67 |espondin|g string|
|000001a0| 2c 20 61 73 20 77 6f 75 | 6c 64 20 62 65 20 70 72 |, as wou|ld be pr|
|000001b0| 69 6e 74 65 64 20 62 79 | 20 74 68 65 20 43 20 66 |inted by| the C f|
|000001c0| 75 6e 63 74 69 6f 6e 0a | 5c 63 6f 64 65 7b 70 65 |unction.|\code{pe|
|000001d0| 72 72 6f 72 28 29 7d 2e | 0a 5c 65 6e 64 7b 65 78 |rror()}.|.\end{ex|
|000001e0| 63 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 66 |cdesc}..|\begin{f|
|000001f0| 75 6e 63 64 65 73 63 7d | 7b 73 65 6c 65 63 74 7d |uncdesc}|{select}|
|00000200| 7b 69 77 74 64 5c 2c 20 | 6f 77 74 64 5c 2c 20 65 |{iwtd\, |owtd\, e|
|00000210| 77 74 64 5c 6f 70 74 69 | 6f 6e 61 6c 7b 5c 2c 20 |wtd\opti|onal{\, |
|00000220| 74 69 6d 65 6f 75 74 7d | 7d 0a 54 68 69 73 20 69 |timeout}|}.This i|
|00000230| 73 20 61 20 73 74 72 61 | 69 67 68 74 66 6f 72 77 |s a stra|ightforw|
|00000240| 61 72 64 20 69 6e 74 65 | 72 66 61 63 65 20 74 6f |ard inte|rface to|
|00000250| 20 74 68 65 20 5c 55 4e | 49 58 7b 7d 20 5c 63 6f | the \UN|IX{} \co|
|00000260| 64 65 7b 73 65 6c 65 63 | 74 28 29 7d 0a 73 79 73 |de{selec|t()}.sys|
|00000270| 74 65 6d 20 63 61 6c 6c | 2e 20 20 54 68 65 20 66 |tem call|. The f|
|00000280| 69 72 73 74 20 74 68 72 | 65 65 20 61 72 67 75 6d |irst thr|ee argum|
|00000290| 65 6e 74 73 20 61 72 65 | 20 6c 69 73 74 73 20 6f |ents are| lists o|
|000002a0| 66 20 60 77 61 69 74 61 | 62 6c 65 0a 6f 62 6a 65 |f `waita|ble.obje|
|000002b0| 63 74 73 27 3a 20 65 69 | 74 68 65 72 20 69 6e 74 |cts': ei|ther int|
|000002c0| 65 67 65 72 73 20 72 65 | 70 72 65 73 65 6e 74 69 |egers re|presenti|
|000002d0| 6e 67 20 5c 55 4e 49 58 | 7b 7d 20 66 69 6c 65 20 |ng \UNIX|{} file |
|000002e0| 64 65 73 63 72 69 70 74 | 6f 72 73 20 6f 72 0a 6f |descript|ors or.o|
|000002f0| 62 6a 65 63 74 73 20 77 | 69 74 68 20 61 20 70 61 |bjects w|ith a pa|
|00000300| 72 61 6d 65 74 65 72 6c | 65 73 73 20 6d 65 74 68 |rameterl|ess meth|
|00000310| 6f 64 20 6e 61 6d 65 64 | 20 5c 63 6f 64 65 7b 66 |od named| \code{f|
|00000320| 69 6c 65 6e 6f 28 29 7d | 20 72 65 74 75 72 6e 69 |ileno()}| returni|
|00000330| 6e 67 0a 73 75 63 68 20 | 61 6e 20 69 6e 74 65 67 |ng.such |an integ|
|00000340| 65 72 2e 20 20 54 68 65 | 20 74 68 72 65 65 20 6c |er. The| three l|
|00000350| 69 73 74 73 20 6f 66 20 | 77 61 69 74 61 62 6c 65 |ists of |waitable|
|00000360| 20 6f 62 6a 65 63 74 73 | 20 61 72 65 20 66 6f 72 | objects| are for|
|00000370| 20 69 6e 70 75 74 2c 0a | 6f 75 74 70 75 74 20 61 | input,.|output a|
|00000380| 6e 64 20 60 65 78 63 65 | 70 74 69 6f 6e 61 6c 20 |nd `exce|ptional |
|00000390| 63 6f 6e 64 69 74 69 6f | 6e 73 27 2c 20 72 65 73 |conditio|ns', res|
|000003a0| 70 65 63 74 69 76 65 6c | 79 2e 20 20 45 6d 70 74 |pectivel|y. Empt|
|000003b0| 79 20 6c 69 73 74 73 20 | 61 72 65 0a 61 6c 6c 6f |y lists |are.allo|
|000003c0| 77 65 64 2e 20 20 54 68 | 65 20 6f 70 74 69 6f 6e |wed. Th|e option|
|000003d0| 61 6c 20 5c 76 61 72 7b | 74 69 6d 65 6f 75 74 7d |al \var{|timeout}|
|000003e0| 20 61 72 67 75 6d 65 6e | 74 20 73 70 65 63 69 66 | argumen|t specif|
|000003f0| 69 65 73 20 61 20 74 69 | 6d 65 2d 6f 75 74 20 61 |ies a ti|me-out a|
|00000400| 73 20 61 0a 66 6c 6f 61 | 74 69 6e 67 20 70 6f 69 |s a.floa|ting poi|
|00000410| 6e 74 20 6e 75 6d 62 65 | 72 20 69 6e 20 73 65 63 |nt numbe|r in sec|
|00000420| 6f 6e 64 73 2e 20 20 57 | 68 65 6e 20 74 68 65 20 |onds. W|hen the |
|00000430| 5c 76 61 72 7b 74 69 6d | 65 6f 75 74 7d 20 61 72 |\var{tim|eout} ar|
|00000440| 67 75 6d 65 6e 74 0a 69 | 73 20 6f 6d 69 74 74 65 |gument.i|s omitte|
|00000450| 64 20 74 68 65 20 66 75 | 6e 63 74 69 6f 6e 20 62 |d the fu|nction b|
|00000460| 6c 6f 63 6b 73 20 75 6e | 74 69 6c 20 61 74 20 6c |locks un|til at l|
|00000470| 65 61 73 74 20 6f 6e 65 | 20 66 69 6c 65 20 64 65 |east one| file de|
|00000480| 73 63 72 69 70 74 6f 72 | 20 69 73 0a 72 65 61 64 |scriptor| is.read|
|00000490| 79 2e 20 20 41 20 74 69 | 6d 65 2d 6f 75 74 20 76 |y. A ti|me-out v|
|000004a0| 61 6c 75 65 20 6f 66 20 | 7a 65 72 6f 20 73 70 65 |alue of |zero spe|
|000004b0| 63 69 66 69 65 73 20 61 | 20 70 6f 6c 6c 20 61 6e |cifies a| poll an|
|000004c0| 64 20 6e 65 76 65 72 20 | 62 6c 6f 63 6b 73 2e 0a |d never |blocks..|
|000004d0| 0a 54 68 65 20 72 65 74 | 75 72 6e 20 76 61 6c 75 |.The ret|urn valu|
|000004e0| 65 20 69 73 20 61 20 74 | 72 69 70 6c 65 20 6f 66 |e is a t|riple of|
|000004f0| 20 6c 69 73 74 73 20 6f | 66 20 6f 62 6a 65 63 74 | lists o|f object|
|00000500| 73 20 74 68 61 74 20 61 | 72 65 20 72 65 61 64 79 |s that a|re ready|
|00000510| 3a 0a 73 75 62 73 65 74 | 73 20 6f 66 20 74 68 65 |:.subset|s of the|
|00000520| 20 66 69 72 73 74 20 74 | 68 72 65 65 20 61 72 67 | first t|hree arg|
|00000530| 75 6d 65 6e 74 73 2e 20 | 20 57 68 65 6e 20 74 68 |uments. | When th|
|00000540| 65 20 74 69 6d 65 2d 6f | 75 74 20 69 73 20 72 65 |e time-o|ut is re|
|00000550| 61 63 68 65 64 0a 77 69 | 74 68 6f 75 74 20 61 20 |ached.wi|thout a |
|00000560| 66 69 6c 65 20 64 65 73 | 63 72 69 70 74 6f 72 20 |file des|criptor |
|00000570| 62 65 63 6f 6d 69 6e 67 | 20 72 65 61 64 79 2c 20 |becoming| ready, |
|00000580| 74 68 72 65 65 20 65 6d | 70 74 79 20 6c 69 73 74 |three em|pty list|
|00000590| 73 20 61 72 65 0a 72 65 | 74 75 72 6e 65 64 2e 0a |s are.re|turned..|
|000005a0| 0a 41 6d 6f 6e 67 73 74 | 20 74 68 65 20 61 63 63 |.Amongst| the acc|
|000005b0| 65 70 74 61 62 6c 65 20 | 6f 62 6a 65 63 74 20 74 |eptable |object t|
|000005c0| 79 70 65 73 20 69 6e 20 | 74 68 65 20 6c 69 73 74 |ypes in |the list|
|000005d0| 73 20 61 72 65 20 50 79 | 74 68 6f 6e 20 66 69 6c |s are Py|thon fil|
|000005e0| 65 0a 6f 62 6a 65 63 74 | 73 20 28 65 2e 67 2e 20 |e.object|s (e.g. |
|000005f0| 5c 63 6f 64 65 7b 73 79 | 73 2e 73 74 64 69 6e 7d |\code{sy|s.stdin}|
|00000600| 2c 20 6f 72 20 6f 62 6a | 65 63 74 73 20 72 65 74 |, or obj|ects ret|
|00000610| 75 72 6e 65 64 20 62 79 | 20 5c 63 6f 64 65 7b 6f |urned by| \code{o|
|00000620| 70 65 6e 28 29 7d 0a 6f | 72 20 5c 63 6f 64 65 7b |pen()}.o|r \code{|
|00000630| 70 6f 73 69 78 2e 70 6f | 70 65 6e 28 29 7d 29 2c |posix.po|pen()}),|
|00000640| 20 73 6f 63 6b 65 74 20 | 6f 62 6a 65 63 74 73 20 | socket |objects |
|00000650| 72 65 74 75 72 6e 65 64 | 20 62 79 0a 5c 63 6f 64 |returned| by.\cod|
|00000660| 65 7b 73 6f 63 6b 65 74 | 2e 73 6f 63 6b 65 74 28 |e{socket|.socket(|
|00000670| 29 7d 2c 20 61 6e 64 20 | 74 68 65 20 6d 6f 64 75 |)}, and |the modu|
|00000680| 6c 65 20 5c 63 6f 64 65 | 7b 73 74 64 77 69 6e 7d |le \code|{stdwin}|
|00000690| 20 77 68 69 63 68 20 68 | 61 70 70 65 6e 73 20 74 | which h|appens t|
|000006a0| 6f 0a 64 65 66 69 6e 65 | 20 61 20 66 75 6e 63 74 |o.define| a funct|
|000006b0| 69 6f 6e 20 5c 63 6f 64 | 65 7b 66 69 6c 65 6e 6f |ion \cod|e{fileno|
|000006c0| 28 29 7d 20 66 6f 72 20 | 6a 75 73 74 20 74 68 69 |()} for |just thi|
|000006d0| 73 20 70 75 72 70 6f 73 | 65 2e 20 20 59 6f 75 20 |s purpos|e. You |
|000006e0| 6d 61 79 0a 61 6c 73 6f | 20 64 65 66 69 6e 65 20 |may.also| define |
|000006f0| 61 20 5c 64 66 6e 7b 77 | 72 61 70 70 65 72 7d 20 |a \dfn{w|rapper} |
|00000700| 63 6c 61 73 73 20 79 6f | 75 72 73 65 6c 66 2c 20 |class yo|urself, |
|00000710| 61 73 20 6c 6f 6e 67 20 | 61 73 20 69 74 20 68 61 |as long |as it ha|
|00000720| 73 20 61 6e 0a 61 70 70 | 72 6f 70 72 69 61 74 65 |s an.app|ropriate|
|00000730| 20 5c 63 6f 64 65 7b 66 | 69 6c 65 6e 6f 28 29 7d | \code{f|ileno()}|
|00000740| 20 6d 65 74 68 6f 64 20 | 28 74 68 61 74 20 72 65 | method |(that re|
|00000750| 61 6c 6c 79 20 72 65 74 | 75 72 6e 73 20 61 20 5c |ally ret|urns a \|
|00000760| 55 4e 49 58 7b 7d 20 66 | 69 6c 65 0a 64 65 73 63 |UNIX{} f|ile.desc|
|00000770| 72 69 70 74 6f 72 2c 20 | 6e 6f 74 20 6a 75 73 74 |riptor, |not just|
|00000780| 20 61 20 72 61 6e 64 6f | 6d 20 69 6e 74 65 67 65 | a rando|m intege|
|00000790| 72 29 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |r)..\end|{funcdes|
|000007a0| 63 7d 0a 5c 74 74 69 6e | 64 65 78 7b 73 6f 63 6b |c}.\ttin|dex{sock|
|000007b0| 65 74 7d 0a 5c 74 74 69 | 6e 64 65 78 7b 73 74 64 |et}.\tti|ndex{std|
|000007c0| 77 69 6e 7d 0a | |win}. | |
+--------+-------------------------+-------------------------+--------+--------+