[pypy-commit] pypy range-immutable: kill some dead code and make fields immutable

fijal noreply at buildbot.pypy.org
Thu Jul 21 16:49:43 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: range-immutable
Changeset: r45825:143aa349dc6d
Date: 2011-07-21 16:49 +0200
http://bitbucket.org/pypy/pypy/changeset/143aa349dc6d/

Log:	kill some dead code and make fields immutable

diff --git a/pypy/objspace/std/rangeobject.py b/pypy/objspace/std/rangeobject.py
--- a/pypy/objspace/std/rangeobject.py
+++ b/pypy/objspace/std/rangeobject.py
@@ -24,6 +24,8 @@
 class W_RangeListObject(W_Object):
     typedef = listtype.list_typedef
     
+    _immutable_fields_ = ['start', 'step', 'length']
+    
     def __init__(w_self, start, step, length):
         assert step != 0
         w_self.start = start
@@ -193,16 +195,6 @@
     w_rangeiter.index = index + 1
     return w_item
 
-# XXX __length_hint__()
-##def len__RangeIter(space,  w_rangeiter):
-##    if w_rangeiter.w_seq is None:
-##        return wrapint(space, 0)
-##    index = w_rangeiter.index
-##    w_length = space.len(w_rangeiter.w_seq)
-##    w_len = space.sub(w_length, wrapint(space, index))
-##    if space.is_true(space.lt(w_len, wrapint(space, 0))):
-##        w_len = wrapint(space, 0)
-##    return w_len
 
 registerimplementation(W_RangeListObject)
 registerimplementation(W_RangeIterObject)


More information about the pypy-commit mailing list