Odd code in lib\os.py

Andrew Wilkinson ajw126NO at SPAMyork.ac.uk
Fri Jan 3 07:17:14 EST 2003


Hi,

I was looking at the os standard library and I noticed that there's some
rather odd code in it.

In the section for NT...
from nt import *
for i in ['_exit']:
    try:
        exec "from nt import " + i
    except ImportError:
        pass

What's wrong with
from nt import *
try:
    from nt import _exit
except ImportError:
    pass

?

I'm trying to statically analyse Python code and unfortunately I can't do
anything with dynamic code such as exec and eval. Having an exec statement
in such as core module is causing me great problems.

Is there any reason for it being there, or can I submit a patch to have it
remove?

Cheers,
Andrew Wilkinson






More information about the Python-list mailing list