[Wisp-cvs] wisp/users/dig bits.py,1.10,1.11
Status: Alpha
                
                Brought to you by:
                
                    digg
                    
                
            | 
     
      
      
      From: <di...@us...> - 2003-04-27 07:35:29
      
     
   | 
Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv7422
Modified Files:
	bits.py 
Log Message:
interpret assignments to [::n] as emits in Bits.__setitem__
Index: bits.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/bits.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- bits.py	27 Apr 2003 07:33:24 -0000	1.10
+++ bits.py	27 Apr 2003 07:35:26 -0000	1.11
@@ -52,7 +52,8 @@
     def __setitem__ (this, index, value):
         if isinstance(index, SliceType):
             start, stop, step = index.start, index.stop, index.step
-            if start == None or stop != None or not step in (1, 2, 4):
+            if start == None: start = len(this._contents)
+            if stop != None or not step in (1, 2, 4):
                 raise 'Bad slice for Bits.__setitem__', index
             if start > len(this._contents): raise IndexError, start
             if step == 1: this._contents[start] = chr(value % 0x100)
 |