class_docstr: Support structure for PVector that implements structural sharing for vectors using a trie.
class_docstr_tok: ["Support","structure","for","PVector","that","implements","structural","sharing","for","vectors","using","a","trie","."]
code: def set(self, i, val):
      # This method could be implemented by a call to mset() but doing so would cause
      # a ~5 X performance penalty on PyPy (considered the primary platform for this implementation
      #  of PVector) so we're keeping this implementation for now.
  
      if not isinstance(i, Integral):
          raise TypeError(
              "'%s' object cannot be interpreted as an index"
              % type(i).__name__
          )
  
      if i < 0:
          i += self._count
  
      if 0 <= i < self._count:
          if i >= self._tail_offset:
              new_tail = list(self._tail)
              new_tail[i & BIT_MASK] = val
              return PythonPVector(
                  self._count, self._shift, self._root, new_tail
              )
  
          return PythonPVector(
              self._count,
              self._shift,
              self._do_set(self._shift, self._root, i, val),
              self._tail,
          )
  
      if i == self._count:
          return self.append(val)
  
      raise IndexError("Index out of range: %s" % (i,))
  
imports: from abc import abstractmethod, ABCMeta
  from ._compat import Sequence, Hashable
  from numbers import Integral
  import operator
  import six
  from pyrsistent._transformations import transform
label_desc: Use image node_id 23 for calling the PythonPVector obj's underlying member method code with example usage: obj.set(i, val) and returns: PythonPVector, self, PythonPVector