Python embedding question: how to expose a new "builtin"?

Rodrigo B. de Oliveira rodrigobamboo at hotmail.com
Thu Nov 21 19:11:53 EST 2002


> 
> Looks to me like the problem is with the _pyapplication object
> rather than with the exposing of it in the built-ins module.  What happens 
> if you architect another way to let Python code get at that same object?  
> Does "is" show the two ways give the same object, and what are the
> symptoms on e.g. dir for each?  I think you should get the same
> results, confirming the problem is with the object and not with
> the way you're choosing to expose it.
> 

Now I'm really confused!

This code

<snip language="python">

print dir(application)
print type(application)
print dir(type(application))
print dir(application)

</snip>

has the following output:

<output>
[]
<type 'isapy.Application'>
['__class__', '__delattr__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__new__', '__reduce__', '__repr__',
'__setattr__', '__str__', 'addHandler', 'minThreadPoolSize', 'onEnd',
'path']
['__class__', '__delattr__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__new__', '__reduce__', '__repr__',
'__setattr__', '__str__', 'addHandler', 'minThreadPoolSize', 'onEnd',
'path']
</output>

After the code "dir(type(application))" executes everything works as
expected (application is correctly installed and I can call its
methods and access its properties).

What could be possibly causing this behavior?

Thanks in advance,
Rodrigo



More information about the Python-list mailing list