#NEWLINE# def _write_IdList( self , out ) : #NEWLINE# #INDENT# code = '\n        def __len__(self):\n            return self._vtk_obj.GetNumberOfIds()\n\n        def __iter__(self):\n            obj = self._vtk_obj\n            n = obj.GetNumberOfIds()\n            for i in range(n):\n                yield obj.GetId(i)\n\n        def _check_key(self, key, n):\n            if type(key) != type(1):\n                raise TypeError("Only integers are valid keys.")\n            if key < 0:\n                key =  n + key\n            if key < 0 or key >= n:\n                raise IndexError("Index %s out of range."%key)\n            return key\n\n        def __getitem__(self, key):\n            obj = self._vtk_obj\n            n = obj.GetNumberOfIds()\n            key = self._check_key(key, n)\n            return obj.GetId(key)\n\n        def __setitem__(self, key, val):\n            obj = self._vtk_obj\n            n = obj.GetNumberOfIds()\n            key = self._check_key(key, n)\n            obj.SetId(key, val)\n\n        def __repr__(self):\n            obj = self._vtk_obj\n            n = obj.GetNumberOfIds()\n            if n <= 10:\n                return repr([x for x in self])\n            else:\n                meth = obj.GetId\n                return \'[%s, ..., %s], length = %s\'%(meth(0),\n                                                     meth(n-1), n)\n\n        def append(self, val):\n            self._vtk_obj.InsertNextId(val)\n            self.update_traits()\n\n        def extend(self, arr):\n            obj = self._vtk_obj\n            for i in arr:\n                obj.InsertNextId(i)\n            self.update_traits()\n\n        def from_array(self, arr):\n            \'\'\'Set the value of the data array using the passed\n            Numeric array or Python list.  This is implemented\n            efficiently.\n            \'\'\'\n            array_handler.array2vtkIdList(arr, self._vtk_obj)\n            self.update_traits()\n\n        ' #NEWLINE# out . write ( self . indent . format ( self ) )