def setComponentByPosition(self, idx, value=noValue,<EOL>verifyConstraints=True,<EOL>matchTags=True,<EOL>matchConstraints=True):
componentType = self.componentType<EOL>try:<EOL><INDENT>currentValue = self._componentValues[idx]<EOL><DEDENT>except IndexError:<EOL><INDENT>currentValue = noValue<EOL>if len(self._componentValues) < idx:<EOL><INDENT>raise error.PyAsn1Error('<STR_LIT>')<EOL><DEDENT><DEDENT>if value is noValue:<EOL><INDENT>if componentType is not None:<EOL><INDENT>value = componentType.clone()<EOL><DEDENT>elif currentValue is noValue:<EOL><INDENT>raise error.PyAsn1Error('<STR_LIT>')<EOL><DEDENT><DEDENT>elif not isinstance(value, base.Asn1Item):<EOL><INDENT>if componentType is not None and isinstance(componentType, base.AbstractSimpleAsn1Item):<EOL><INDENT>value = componentType.clone(value=value)<EOL><DEDENT>elif currentValue is not noValue and isinstance(currentValue, base.AbstractSimpleAsn1Item):<EOL><INDENT>value = currentValue.clone(value=value)<EOL><DEDENT>else:<EOL><INDENT>raise error.PyAsn1Error('<STR_LIT>' % (value, self))<EOL><DEDENT><DEDENT>elif componentType is not None:<EOL><INDENT>if self.strictConstraints:<EOL><INDENT>if not componentType.isSameTypeWith(value, matchTags, matchConstraints):<EOL><INDENT>raise error.PyAsn1Error('<STR_LIT>' % (value, componentType))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not componentType.isSuperTypeOf(value, matchTags, matchConstraints):<EOL><INDENT>raise error.PyAsn1Error('<STR_LIT>' % (value, componentType))<EOL><DEDENT><DEDENT><DEDENT>if verifyConstraints and value.isValue:<EOL><INDENT>try:<EOL><INDENT>self.subtypeSpec(value, idx)<EOL><DEDENT>except error.PyAsn1Error:<EOL><INDENT>exType, exValue, exTb = sys.exc_info()<EOL>raise exType('<STR_LIT>' % (exValue, self.__class__.__name__))<EOL><DEDENT><DEDENT>if currentValue is noValue:<EOL><INDENT>self._componentValues.append(value)<EOL><DEDENT>else:<EOL><INDENT>self._componentValues[idx] = value<EOL><DEDENT>return self<EOL>
Assign |ASN.1| type component by position.

        Equivalent to Python sequence item assignment operation (e.g. `[]`)
        or list.append() (when idx == len(self)).

        Parameters
        ----------
        idx: :class:`int`
            Component index (zero-based). Must either refer to existing
            component or to N+1 component. In the latter case a new component
            type gets instantiated (if *componentType* is set, or given ASN.1
            object is taken otherwise) and appended to the |ASN.1| sequence.

        Keyword Args
        ------------
        value: :class:`object` or :py:class:`~pyasn1.type.base.PyAsn1Item` derivative
            A Python value to initialize |ASN.1| component with (if *componentType* is set)
            or ASN.1 value object to assign to |ASN.1| component.

        verifyConstraints: :class:`bool`
             If `False`, skip constraints validation

        matchTags: :class:`bool`
             If `False`, skip component tags matching

        matchConstraints: :class:`bool`
             If `False`, skip component constraints matching

        Returns
        -------
        self

        Raises
        ------
        IndexError:
            When idx > len(self)