def _assign(self, node, left, rest):
        jsvars = self.jsvars.copy()
        lineno = self.track_lineno(node)
        if len(rest) == 1:
            right = self.dispatch(rest[0])
        else:
            self.assert_value(node, rest[1].value, '=')
            right = self._assign(node, rest[0], rest[2:])
        if not isinstance(left, Node):
            if isinstance(self.names[-1], ClassNames):
                self.dispatch(left, assign=right)
                left = left.value
                jsvars.update(locals())
                return "%(setattr)s(%(funcbase)s, ['%(left)s'], %(right)s)" % jsvars
            left = self.dispatch(left, assign=right)
        elif type_repr(left.type) in ['testlist_star_expr', 'atom', 'exprlist']:
            # Assignment to tuple or list (aka tuple assignment)
            # children for:
            # a, b = foo
            # [Node(testlist_star_expr, [Leaf(1, 'a'), Leaf(12, ','), Leaf(1, 'b')]), Leaf(22, '='), Leaf(1, 'foo')]
            # (a, b) = foo
            # [Node(atom, [Leaf(7, '('), Node(testlist_gexp, [Leaf(1, 'a'), Leaf(12, ','), Leaf(1, 'b')]), Leaf(8, ')')]), Leaf(22, '='), Leaf(1, 'foo')]
            # for k, v in foo:
            #    pass
            # [Node(exprlist, [Leaf(1, 'k'), Leaf(12, ','), Leaf(1, 'v')]), Leaf(22, '='), Leaf(1, 'for$1')]
            head_lines = []
            lines = []
            def tuple_assign(left, right):
                if type_repr(left.type) == 'atom':
                    children = left.children[1:-1]
                    if isinstance(children[0], Node) and \
                       type_repr(children[0].type) in ['testlist_gexp', 'listmaker']:
                        children = children[0].children[:]
                else:
                    children = left.children[:]
                n = len(children) / 2 + 1
                rhs = self.get_tmp_jsname('tplass$')
                jsvars.update(locals())
                self.add_lines("var %(rhs)s;" % jsvars)
                head_lines.append(
                    "%(rhs)s = %(builtin)s['tplass'](%(right)s, %(n)s);" % jsvars
                )
                idx = -1
                for child in children:
                    if isinstance(child, Leaf) and child.value == ',':
                        continue
                    idx += 1
                    right = self.create_getindex_stmt(
                        idx=1,
                        subst_base=rhs,
                        subst_idx=str(idx),
                    ).children[0]
                    if isinstance(child, Node) and type_repr(child.type) == 'atom':
                        self.assert_value(node, child.children[0].value, ['(', '['])
                        right = self.dispatch(right)
                        tuple_assign(child, right)
                    else:
                        self.dispatch(child, assign=right)
                        n = self.create_assign_stmt(
                            subst_lhs=child,
                            subst_rhs=right,
                        ).children[0]
                        line = self.node_expr_stmt(n)
                        if line[-1] != ';':
                            line += ';'
                        lines.append(line)
            tuple_assign(left, right)
            lines = head_lines + lines
            return '\n'.join(lines)
        elif type_repr(left.type) == 'power':
            tail = left.children.pop()
            if len(left.children) > 1:
                base = self.dispatch(left)
            else:
                base = self.dispatch(left.children[0])
            if isinstance(base, Code):
                base = str(base)
            self.assert_instance(node, base, basestring)
            args = []
            if type_repr(tail.type) == 'trailer':
                what = tail.children[1]
                if tail.children[0].value == '.':
                    # setattr
                    op = 'setattr'
                    if isinstance(what, Leaf):
                        what = repr(what.value)
                    else:
                        what = self.dispatch(what)
                    what = "[%s]" % what
                elif tail.children[0].value == '[':
                    op, what = self.get_op_item(
                        what, 'setitem', 'setslice',
                    )
                else:
                    self.not_implemented(node)
                jsvars.update(locals())
                return """\
%(builtin)s['%(op)s'](%(base)s, %(what)s, %(right)s)\
""" % jsvars
            else:
                self.not_implemented(node)
        else:
            left = self.dispatch(left)
        return '%s = %s' % (left, right)
dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/translator_dict.py/Translator._assign/original