Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Thomas W
Great !!! That works like charm. Thanks alot. Thomas Leo Kislov wrote: > Thomas W wrote: > > Maybe a stupid subject, but this is what I want to do : > > > > I got some python code stored in a string: > > > > somecode = """ > > > > from somemodule import ISomeInterface > > > > class Foo(ISomeIn

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Leo Kislov
Thomas W wrote: > Maybe a stupid subject, but this is what I want to do : > > I got some python code stored in a string: > > somecode = """ > > from somemodule import ISomeInterface > > class Foo(ISomeInterface): > param1 = ... > param2 = > > """ > > and I want to compile that code so

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Fredrik Lundh
Thomas W wrote: > from somemodule import ISomeInteface > > d = compile(sourcecode) > > myfoo = d.Foo() > > print ISomeInterface in myfoo.__bases__ > > Any hints? Python is a dynamic language, so compiling something won't tell you much about what the code actually does. the only reliable way