Hi,
You can also do this :
import maya.OpenMaya as api
m = api.MMatrix()
print tuple(tuple(api.MScriptUtil.getDoubleArrayItem ( m[r], c) for c
in xrange(4)) for r in xrange(4))
# ((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0),
(0.0, 0.0, 0.0, 1.0))
All the trouble with MScriptUtil (and the pitfall I fell in when first
trying them) is to remember it doesn't allocate memory for you, when
you pass it a pointer it has to have been initialised first (was a
related thread in this group a coupe of months ago). Still its a quite
ugly thing nonetheless.
For the adventurous, latest pymel in SVN trunk has the MVector, MPoint,
MColor and MMatrix wrap working (still some work on fine tuning
MTransformationMatrix, MQuaternion, MEulerRotation, though, essentially
deciding how to organise them).
Check the tests et the end of wrappedtypes.py, they give an idea of
what is doable : MVector and MMatrix are rewrapped from the api as
classes derived both from their OpenMaya equivalent (means the api
methods will accept them directly) and from generic Vector and Matrix
classes (means you can also use n-sized matrices and vectors, and
inherit some more useful methods from these too).
Matrix and Vector are a very much numpy like Python implementation
(check help on these), so that it would be easy to actually also derive
them from numpy array / matrix classes if people feel they want that.
I'd be happy to get feedback on these.
Olivier