How to pass list of inhomogeneous array of python to c++ InputArrays

Hi, I’m trying to pass list of inhomogeneous array between python and c++ by opencv bindings, just like cv2.findContours() will return contours that is a list of numpy arrays, I want to know how to do it, any suggestion?

I have tried to pass it by the proxy InputArraysOfArrays like:

void func(InputArrayOfArrays src, OutputArray dst)
    cv::Mat M = src.getMat();

but it doesn’t work, the error says:

Overload resolution failed:
- src is not a numpy array, neither a scalar
 - Expected Ptr<cv::UMat> for argument 'src'

but when I trace cv2.findContours() source code, it indeed use OutputArrayOfArrays as contours return proxy:

void cv::findContours( InputArray _image, OutputArrayOfArrays _contours,
                       int mode, int method, Point offset)

    findContours(_image, _contours, noArray(), mode, method, offset);

what is the magic behind this ?