On 10/31/2011 11:01 PM, dhyams wrote:

Thanks for all of the responses; everyone was exactly correct, and
obeying the binding rules for special methods did work in the example
above.  Unfortunately, I only have read-only access to the class
itself (it was a VTK class wrapped with SWIG), so I had to find
another way to accomplish what I was after.


As a big huge hack, you can always write a wrapper class:

class Wrapper(object):
    def __init__(self, *args, **kwargs):
        self.__object = MySWIGClass(*args, **kwargs)
    def __getattr__(self, attr):
        try:
            return getattr(self.__object, attr)
        except AttributeError:
            ...

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to