def __setitem__(self, key, value):
    'Support item assignment of new attributes or values\n\n        Example:\n            >>> _ = cmds.file(new=True, force=True)\n            >>> node = createNode("transform", name="myNode")\n            >>> node["myAttr"] = Double(default=1.0)\n            >>> node["myAttr"] == 1.0\n            True\n            >>> node["rotateX", Degrees] = 1.0\n            >>> node["rotateX"] = Degrees(1)\n            >>> node["rotateX", Degrees]\n            1.0\n            >>> node["myDist"] = Distance()\n            >>> node["myDist"] = node["translateX"]\n            >>> node["myDist", Centimeters] = node["translateX", Meters]\n            >>> round(node["rotateX", Radians], 3)\n            0.017\n            >>> node["myDist"] = Distance()\n            Traceback (most recent call last):\n            ...\n            ExistError: myDist\n            >>> node["notExist"] = 5\n            Traceback (most recent call last):\n            ...\n            ExistError: |myNode.notExist\n            >>> delete(node)\n\n        '
    if isinstance(value, Plug):
        value = value.read()
    unit = None
    if isinstance(key, (list, tuple)):
        (key, unit) = key
        if isinstance(value, (list, tuple)):
            value = list((unit(v) for v in value))
        else:
            value = unit(value)
    elif isinstance(value, (tuple, list)):
        if isinstance(value[0], type):
            if issubclass(value[0], _AbstractAttribute):
                (Attribute, kwargs) = value
                attr = Attribute(key, **kwargs)
                try:
                    return self.addAttr(attr.create())
                except RuntimeError:
                    raise ExistError(key)
    try:
        plug = self.findPlug(key)
    except RuntimeError:
        raise ExistError(('%s.%s' % (self.path(), key)))
    plug = Plug(self, plug, unit=unit)
    if (not getattr(self._modifier, 'isDone', True)):
        if _python_to_mod(value, plug, self._modifier._modifier):
            return
        else:
            log.warning(('Could not write %s via modifier, writing directly..' % plug))
    plug.write(value)
Support item assignment of new attributes or values

Example:
    >>> _ = cmds.file(new=True, force=True)
    >>> node = createNode("transform", name="myNode")
    >>> node["myAttr"] = Double(default=1.0)
    >>> node["myAttr"] == 1.0
    True
    >>> node["rotateX", Degrees] = 1.0
    >>> node["rotateX"] = Degrees(1)
    >>> node["rotateX", Degrees]
    1.0
    >>> node["myDist"] = Distance()
    >>> node["myDist"] = node["translateX"]
    >>> node["myDist", Centimeters] = node["translateX", Meters]
    >>> round(node["rotateX", Radians], 3)
    0.017
    >>> node["myDist"] = Distance()
    Traceback (most recent call last):
    ...
    ExistError: myDist
    >>> node["notExist"] = 5
    Traceback (most recent call last):
    ...
    ExistError: |myNode.notExist
    >>> delete(node)
def __setitem__(self, key, value):
    'Support item assignment of new attributes or values\n\n        Example:\n            >>> _ = cmds.file(new=True, force=True)\n            >>> node = createNode("transform", name="myNode")\n            >>> node["myAttr"] = Double(default=1.0)\n            >>> node["myAttr"] == 1.0\n            True\n            >>> node["rotateX", Degrees] = 1.0\n            >>> node["rotateX"] = Degrees(1)\n            >>> node["rotateX", Degrees]\n            1.0\n            >>> node["myDist"] = Distance()\n            >>> node["myDist"] = node["translateX"]\n            >>> node["myDist", Centimeters] = node["translateX", Meters]\n            >>> round(node["rotateX", Radians], 3)\n            0.017\n            >>> node["myDist"] = Distance()\n            Traceback (most recent call last):\n            ...\n            ExistError: myDist\n            >>> node["notExist"] = 5\n            Traceback (most recent call last):\n            ...\n            ExistError: |myNode.notExist\n            >>> delete(node)\n\n        '
    if isinstance(value, Plug):
        value = value.read()
    unit = None
    if isinstance(key, (list, tuple)):
        (key, unit) = key
        if isinstance(value, (list, tuple)):
            value = list((unit(v) for v in value))
        else:
            value = unit(value)
    elif isinstance(value, (tuple, list)):
        if isinstance(value[0], type):
            if issubclass(value[0], _AbstractAttribute):
                (Attribute, kwargs) = value
                attr = Attribute(key, **kwargs)
                try:
                    return self.addAttr(attr.create())
                except RuntimeError:
                    raise ExistError(key)
    try:
        plug = self.findPlug(key)
    except RuntimeError:
        raise ExistError(('%s.%s' % (self.path(), key)))
    plug = Plug(self, plug, unit=unit)
    if (not getattr(self._modifier, 'isDone', True)):
        if _python_to_mod(value, plug, self._modifier._modifier):
            return
        else:
            log.warning(('Could not write %s via modifier, writing directly..' % plug))
    plug.write(value)