On 18 May 2007 15:51:40 -0700
ici <[EMAIL PROTECTED]> wrote:

> exec it :)

Thank you! That works when I compile/exec it in the main body of the
program. However, when I try to do that in a separate module it
doesn't. For example:

Module Foo:
import compiler

class Foo:
        def __init__ (self):
                return
        def register (self, text):
                exec (compiler.compile (text, "<string>",
                                                "exec"))

File Bar:
import Foo

f = Foo.Foo ()
f.register ("def blah():\n\tprint 'blah'\n")

In this case, the function 'blah' is nowhere to be found. I've tried
looking in 'f', in the class 'Foo', in the module 'Foo' and it's
nowhere.

-- 
Mitko Haralanov                                  [EMAIL PROTECTED]
Senior Software Engineer                             650.934.8064
System Interconnect Group                   http://www.qlogic.com

==========================================
((lambda (foo) (bar foo)) (baz))
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to