Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Below <;)* function, try to pass around filelike instances instead of KKK92/,60<2T0:>)30*;<0=
KKK9-q9L9/1C-6250//,!2-0*:M5;+MQ9/@033L#610Q9
filenames, ie /./,/+A)*, 4+6)*?I&,4+6)*?I&:=, 2-0*:=. /+A21+L/1C-6250//,!I!FQ9/+A)*L/1C-6250//,!I!FQ9
532/0(>A/L#610=
Executing other scripts KKK9A0>9-r:)*-1+=V
Generator interface ,,,999MMM9;AA9ih9+293)*09)*9)*-1+9MMM
,,,999>2693)*09)*9)*-1+V
Have file instance methods call generator methods when Reading output ,,,99999.)03A9MsAs/M9s:)*+:3)*0,/+6)-:==jihQ9
appropriate. Don't accumulate data if you don't need to, .)03A, 2/,3)*0/0-=
reduce or drop it. KKK9)<-26+9/1C-6250// KKK9-t9L9/1C-6250//,!2-0*:M[59P3MQ9/@033L#610Q9
KKK9-9L9/1C-6250//,!2-0*:M)A9P1MQ9/@033L#610Q9 /+A21+L/1C-6250//,!I!FQ9/+A)*L/1C-6250//,!I!FQ9
/+A21+L/1C-6250//,!I!FQ9/+A066L/1C-6250//,!I!F= 532/0(>A/L#610=
KKK9-6250//(3)*09L9-6250//(A;+;
KKK9-,/+A21+,60;A:= KKK9)?*2609L9O-q,/+A)*,[6)+0:/+6:N=j2/,3)*0/0-=9>269N9
Don't do: Mihhhg*M )*9N6;*?0:n=R
KKK9-,60+16*52A09D9'2*09<0;*/9*2+9A2*0 KKK9-q,/+A)*,532/0:=
KKK9-6)*+9-,[;)+:= KKK9)?*2609L9O-t,/+A)*,[6)+0:N=9>269N9)*9
KKK9)*-1+9L9>)*,60;A3)*0/:= -r:-q,/+A21+,N60;A3)*0/:==R
KKK9>2693)*09)*9)*-1+V9D9@23A/90*+)609>)30 h
KKK9-t,/+A)*,532/0:=
,,,999-6250//(3)*0:3)*0= KKK9-t,/+A21+,60;A:=
Mng*M
Do: Feeding $%&'(
Can use 52<<1*)5;+0 or -e,/+A)*,[6)+0 w/ >31/@8532/0.
KKK9>2693)*09)*9>)*V9D960;A93)*09;+9;9+)<0 PID file
,,,999-6250//(3)*0:3)*0=
KKK9-e9L9/1C-6250//,!2-0*:M[59P3MQ9/@033L#610Q9 As a mechanism for preventing concurrent runs of script. Be careful
see http://www.dabeaz.com/generators/ /+A21+L/1C-6250//,!I!FQ9/+A)*L/1C-6250//,!I!FQ9
with file permissions (user write access only, use 2/,5@<2A).
)%*+'% ,('%%*$%
Simple Example
The ;+0N)+ module provides 60?)/+06:>1*5Q9OQ;6?/9 Execute unittests at the level of abstraction you want, filename (via
OQB[;6?/RR= to perform >1*5 when the interpreter exits KKK932??)*?,C;/)5Y2*>)?:30T03L32??)*?,GFlk`Q9 <;)*), file object or generator.
>)30*;<0LM,32?M=
KKK932??)*?,A0C1?:M.2169</?9@060M= Coverage tools can be useful to see where tests are missing (see
Theft Packaging >)?30;> or 52T06;?0,-.)