Mark Hammond wrote: >> Really? This is not my experience. I am using whatever the default >> policy is on all of my objects, and a test case very much like my >> "Person" and "Title" example below fails unless I loop through the >> `titles` attribute of my Person instances and manually wrap the >> Title instances before returning the Person instance. >> >> Am I doing something wrong? Do I need to use a different policy to >> make this happen? > > It should work as described. Logically, there should be no need > to wrap an object until it is actually passed via COM. ie, if the > person.titles attribute was never referenced it should never need to > be wrapped - which implies it could be wrapped as late as possible > rather than as early as possible.
Strangely enough, if I attempt to return a `Person` instance that has a `title` attribute that is a list populated with `Title` instances, the only way that I can get it to return without raising an Exception is to loop through all of the `Title` objects and replace them with wrapped versions. That being said, I have mostly made my project work. I ended up just writing some utility functions that can walk through the object's attributes recursively (including traversing lists/tuples) and wrap or unwrap accordingly. Its a little gross, but it works! Thanks again for the help. By and large, this project makes COM easy to work with, when my prior experiences had been fairly painful. -- Jonathan LaCour http://cleverdevil.org _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32