ma*********************@yahoo.com wrote:
Hi, why does
>>>import compiler
compileFile("foo.py")
complain name 'compileFile' not defined.
Probably because it's not ?
import <modulenameimports the name <modulenamein the current
namespace. Then <modulenamelet you access all the names defined in
<modulenamenamespace. So in you're case, it should be:
>>>import compiler
compiler.compileFile("foo.py")
But
>>from compiler import *
works.
"from <modulenameimport <somename>" directly loads <somenameinto the
current namespace. The 'import *' loads all public names from
<modulename>. And FWIW it's usually considered bad style (potential
name clash, and can makes hard to tell where a name is defined...)
HTH
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"