Skip to content

Commit 5cc1823

Browse files
author
hartsantler
committed
support slice set a[ n:n ] = iterable.
use latest pypy2.3 in benchmarks if its installed to the user's home directory.
1 parent 8d2c5ea commit 5cc1823

5 files changed

Lines changed: 212 additions & 146 deletions

File tree

pythonjs/python_to_pythonjs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,9 @@ def _visit_assign_helper(self, node, target):
15841584
#code = '%s["$wrapped"] = %s' %(self.visit(target.value), self.visit(node.value))
15851585
code = '%s[...] = %s' %(self.visit(target.value), self.visit(node.value))
15861586

1587+
elif isinstance(target.slice, ast.Slice):
1588+
code = '%s.__setslice__(%s, %s)' %(self.visit(target.value), self.visit(target.slice), self.visit(node.value))
1589+
15871590
elif self._with_dart or self._with_ll:
15881591
code = '%s[ %s ] = %s'
15891592
code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value))
@@ -1596,7 +1599,6 @@ def _visit_assign_helper(self, node, target):
15961599
code = '%s[ __ternary_operator__(%s.__uid__, %s) ] = %s' % (self.visit(target.value), s, s, self.visit(node.value))
15971600

15981601
elif name in self._func_typedefs and self._func_typedefs[name] == 'list':
1599-
#code = '%s[...][%s] = %s'%(name, self.visit(target.slice.value), self.visit(node.value))
16001602
code = '%s[%s] = %s'%(name, self.visit(target.slice.value), self.visit(node.value))
16011603

16021604
else:

0 commit comments

Comments
 (0)