[Ironpython-users] instropection in an embedded engine

Hernán Foffani hfoffani at gmail.com
Fri Sep 23 18:08:53 CEST 2011

Having the following Python code:

    class Plugin:
      def method(self):
    plugin = Plugin()

and an embedded ScriptScope instance in my .NET application,
the following C# works fine

   dynamic plugin = pythonEngine.GetVariable("plugin");
   var attrs = plugin.__class__.__dict__;

if Plugin python class was defined as an old-style class, but fails if
Plugin inherits from object (__class__ non existent).

Under the VS debugger the dynamic object plugin shows as having three
attributes .class, .dict and .slots_and_weakref (with dots in their names) but
no __class__ or __dict__.

I found that I could do something like plugin.method.im_class.__dict__ but
I'd rather stick with the common idiom.

Is it a known issue? Something related to the way I'm using the engine?

Thanks in advance,

More information about the Ironpython-users mailing list