'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.
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)'

def setComponentByPosition(self, idx, value=noValue, verifyConstraints=True, matchTags=True, matchConstraints=True):

    componentType = self._componentType
    try:
        currentValue = self._componentValues[idx]
    except IndexError:
        currentValue = None
        if (len(self._componentValues) < idx):
            raise error.PyAsn1Error('Component    index    out    of    range')
    if ((value is None) or (value is noValue)):
        if (componentType is not None):
            value = componentType.clone()
        elif (currentValue is None):
            raise error.PyAsn1Error('Component    type    not    defined')
    elif (not isinstance(value, base.Asn1Item)):
        if ((componentType is not None) and isinstance(componentType, base.AbstractSimpleAsn1Item)):
            value = componentType.clone(value=value)
        elif ((currentValue is not None) and isinstance(currentValue, base.AbstractSimpleAsn1Item)):
            value = currentValue.clone(value=value)
        else:
            raise error.PyAsn1Error(('%s    undefined    component    type' % componentType.__class__.__name__))
    elif (componentType is not None):
        if self.strictConstraints:
            if (not componentType.isSameTypeWith(value, matchTags, matchConstraints)):
                raise error.PyAsn1Error(('Component    value    is    tag-incompatible:    %r    vs    %r' % (value, componentType)))
        elif (not componentType.isSuperTypeOf(value, matchTags, matchConstraints)):
            raise error.PyAsn1Error(('Component    value    is    tag-incompatible:    %r    vs    %r' % (value, componentType)))
    if (verifyConstraints and value.isValue):
        try:
            self._subtypeSpec(value, idx)
        except error.PyAsn1Error:
            (exType, exValue, exTb) = sys.exc_info()
            raise exType(('%s    at    %s' % (exValue, self.__class__.__name__)))
    if (currentValue is None):
        self._componentValues.append(value)
    else:
        self._componentValues[idx] = value
    return self
