SWIG Extension/coersion question.

Justin Shaw wyojustin at hotmail.com
Thu Jan 2 17:01:50 EST 2003


I have a python class called Array that wraps some of SWIG's carray module.
When calling SWIG wrapped functions that call for double pointers, I'd like
my arrays to be able to cast them selves to double pointers.

An example will clarify:

Currently my code looks like this:

# ok.py
import wrapper
import carray

a = Array([1, 2, 3], 'double')
wrapper.func(a.getPtr())


I want it to look like this (no explicit call to getPtr()):

# better.py
import wrapper
import carray

a = Array([1, 2, 3], 'double')
wrapper.func(a)

Any way to do this?

Thanks,
Justin






More information about the Python-list mailing list