That's because it isn't out of bounds, it's a sparse array that resizes automatically.
On Sep 29, 6:03 pm, Adam Mechtley <[email protected]> wrote: > I've run into something a little confusing I am hoping someone here can > clarify. Try this: > > import maya.OpenMaya as OM > > testArray = OM.MDagPathArray() > print testArray.length() > > You will of course get: > > 0 > > Now try this: > > print testArray[0] > > You will of course get: > > None > > However, even though this array is empty, if you do this: > > print testArray[1] > > or this: > > print testArray[100] > > you will get something like this: > > <maya.OpenMaya.MDagPath; proxy of <Swig Object of type 'MDagPath *' at 0x8> > > > > The reason this is causing me problems is because I am wanting to catch an > index out of bounds exception for an MDagPathArray in a plugin. However, > Maya Python does not seem to mind that I am trying to access an index that > is out of bounds. Any ideas? --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
