1 |
> To back myself up: |
2 |
> |
3 |
> <file name="why_no.py"> |
4 |
> #!/usr/bin/python |
5 |
> |
6 |
> import random |
7 |
> |
8 |
> for i in range(1,10000): |
9 |
> if random.random() < 0.001: |
10 |
> print "rare" |
11 |
> if malformed < beast: |
12 |
> print "kick me in the ..." |
13 |
> else: |
14 |
> print "whatever" |
15 |
> </file> |
16 |
This kind of error is not a syntax error; this kind of error is indeed |
17 |
only discovered at runtime. However, syntax errors are discovered at |
18 |
byte-compile time. byte-compile happens automatically when you load a |
19 |
module, but you can perform it yourself easily, and this is |
20 |
recommended in certain situations. |
21 |
|
22 |
For this kind of error (try to reference an undefined variable), there |
23 |
are tools like pychecker. |
24 |
|
25 |
-- |
26 |
Software is like sex: it is better when it is free - Linus Torvalds |