def __getitem__(self, index):
    'Read from child of array or compound plug\n\n        Arguments:\n            index (int): Logical index of plug (NOT physical, make note)\n\n        Example:\n            >>> _ = cmds.file(new=True, force=True)\n            >>> node = createNode("transform", name="mynode")\n            >>> node["translate"][0].read()\n            0.0\n            >>> node["visibility"][0]\n            Traceback (most recent call last):\n            ...\n            TypeError: |mynode.visibility does not support indexing\n            >>> node["translate"][2] = 5.1\n            >>> node["translate"][2].read()\n            5.1\n\n        '
    cls = self.__class__
    if isinstance(index, int):
        if (index < 0):
            index = (self.count() - abs(index))
        if self._mplug.isArray:
            item = self._mplug.elementByLogicalIndex(index)
            return cls(self._node, item, self._unit)
        elif self._mplug.isCompound:
            item = self._mplug.child(index)
            return cls(self._node, item, self._unit)
        else:
            raise TypeError(('%s does not support indexing' % self.path()))
    elif isinstance(index, string_types):
        if self._mplug.isCompound:
            for child in range(self._mplug.numChildren()):
                child = self._mplug.child(child)
                (_, name) = child.name().rsplit('.', 1)
                if (index == name):
                    return cls(self._node, child)
        else:
            raise TypeError(("'%s' is not a compound attribute" % self.path()))
        raise ExistError(("'%s' was not found" % index))
Read from child of array or compound plug

Arguments:
    index (int): Logical index of plug (NOT physical, make note)

Example:
    >>> _ = cmds.file(new=True, force=True)
    >>> node = createNode("transform", name="mynode")
    >>> node["translate"][0].read()
    0.0
    >>> node["visibility"][0]
    Traceback (most recent call last):
    ...
    TypeError: |mynode.visibility does not support indexing
    >>> node["translate"][2] = 5.1
    >>> node["translate"][2].read()
    5.1
def __getitem__(self, index):
    'Read from child of array or compound plug\n\n        Arguments:\n            index (int): Logical index of plug (NOT physical, make note)\n\n        Example:\n            >>> _ = cmds.file(new=True, force=True)\n            >>> node = createNode("transform", name="mynode")\n            >>> node["translate"][0].read()\n            0.0\n            >>> node["visibility"][0]\n            Traceback (most recent call last):\n            ...\n            TypeError: |mynode.visibility does not support indexing\n            >>> node["translate"][2] = 5.1\n            >>> node["translate"][2].read()\n            5.1\n\n        '
    cls = self.__class__
    if isinstance(index, int):
        if (index < 0):
            index = (self.count() - abs(index))
        if self._mplug.isArray:
            item = self._mplug.elementByLogicalIndex(index)
            return cls(self._node, item, self._unit)
        elif self._mplug.isCompound:
            item = self._mplug.child(index)
            return cls(self._node, item, self._unit)
        else:
            raise TypeError(('%s does not support indexing' % self.path()))
    elif isinstance(index, string_types):
        if self._mplug.isCompound:
            for child in range(self._mplug.numChildren()):
                child = self._mplug.child(child)
                (_, name) = child.name().rsplit('.', 1)
                if (index == name):
                    return cls(self._node, child)
        else:
            raise TypeError(("'%s' is not a compound attribute" % self.path()))
        raise ExistError(("'%s' was not found" % index))