[pypy-svn] rev 2214 - pypy/trunk/src/pypy/translator
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Tue Nov 18 04:56:55 CET 2003
Author: sanxiyn
Date: Tue Nov 18 04:56:55 2003
New Revision: 2214
Modified:
pypy/trunk/src/pypy/translator/transform.py
Log:
Corrected confusing comments that conflicts with docstring.
Modified: pypy/trunk/src/pypy/translator/transform.py
==============================================================================
--- pypy/trunk/src/pypy/translator/transform.py (original)
+++ pypy/trunk/src/pypy/translator/transform.py Tue Nov 18 04:56:55 2003
@@ -5,11 +5,15 @@
"""
import autopath
+import types
from pypy.objspace.flow.model import Variable, Constant, SpaceOperation
-# b = newlist(a)
-# d = mul(b, int c)
-# --> d = alloc_and_set(c, a)
+# [a] * b
+# -->
+# c = newlist(a)
+# d = mul(c, int b)
+# -->
+# d = alloc_and_set(b, a)
def transform_allocate(self):
"""Transforms [a] * b to alloc_and_set(b, a) where b is int."""
@@ -30,9 +34,12 @@
op2.result)
block.operations[i:i+2] = [new_op]
-# c = newslice(a, b, None)
-# e = getitem(d, c)
-# --> e = getslice(d, a, b)
+# a[b:c]
+# -->
+# d = newslice(b, c, None)
+# e = getitem(a, d)
+# -->
+# e = getslice(a, b, c)
def transform_slice(self):
"""Transforms a[b:c] to getslice(a, b, c)."""
@@ -44,7 +51,7 @@
op1 = operations[i]
op2 = operations[i+1]
if (op1.opname == 'newslice' and
- t.get_type(self.binding(op1.args[2])) is type(None) and
+ t.get_type(self.binding(op1.args[2])) is types.NoneType and
op2.opname == 'getitem' and
op1.result is op2.args[1]):
new_op = SpaceOperation('getslice',
More information about the Pypy-commit
mailing list