def insert ( self, index, value ):
        trait = getattr( self, 'trait', None )
        if trait is None:
            return list.insert(self, index, value)
        if trait.minlen <= (len( self ) + 1) <= trait.maxlen:
            try:
                validate = trait.item_trait.handler.validate
                object   = self.object()
                if validate is not None:
                    value = validate( object, self.name, value )

                list.insert( self, index, value )

                if self.name_items is not None:
                    # Length before the insertion.
                    original_len = len( self ) - 1

                    # Indices outside [-original_len, original_len] are clipped.
                    # This matches the behaviour of insert on the
                    # underlying list.
                    if index < 0:
                        index += original_len
                        if index < 0:
                            index = 0
                    elif index > original_len:
                        index = original_len

                    self._send_trait_items_event( self.name_items,
                        TraitListEvent( index, None, [ value ] ),
                        trait.items_event() )

                return

            except TraitError, excp:
                excp.set_prefix( 'Each element of the' )
                raise excp

        self.len_error( len( self ) + 1 )
dataset/ETHPy150Open enthought/traits/traits/trait_handlers.py/TraitListObject.insert/original