Message140320
| Author |
r.david.murray |
| Recipients |
Calvin.Spealman, eric.snow, r.david.murray |
| Date |
2011年07月14日.01:28:57 |
| SpamBayes Score |
6.4122037e-07 |
| Marked as misclassified |
No |
| Message-id |
<1310606938.7.0.203712329856.issue12554@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In fact, to hopefully make perfectly clear what is going on here, let me demonstrate that *any* executable statement in the module that fails to load is executed if it occurs before the error that causes the load failure:
rdmurray@hey:~/python/p32>cat temp.py
import os
print('foo:', hasattr(os, 'foo'))
try:
import temp2
except AttributeError:
print('attribute error')
print('temp2:', 'temp2' in globals())
print('foo:', hasattr(os, 'foo'))
rdmurray@hey:~/python/p32>cat temp2.py
import os
os.foo = 2
os.bar
rdmurray@hey:~/python/p32>./python temp.py
foo: False
attribute error
temp2: False
foo: True |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年07月14日 01:28:58 | r.david.murray | set | recipients:
+ r.david.murray, Calvin.Spealman, eric.snow |
| 2011年07月14日 01:28:58 | r.david.murray | set | messageid: <1310606938.7.0.203712329856.issue12554@psf.upfronthosting.co.za> |
| 2011年07月14日 01:28:57 | r.david.murray | link | issue12554 messages |
| 2011年07月14日 01:28:57 | r.david.murray | create |
|