[Python-checkins] python/dist/src/Lib asynchat.py,1.18,1.19 cgi.py,1.73,1.74 cmd.py,1.30,1.31 mailbox.py,1.37,1.38 imaplib.py,1.53,1.54 multifile.py,1.20,1.21 mutex.py,1.10,1.11 Queue.py,1.15,1.16 threading.py,1.23,1.24 pickle.py,1.66,1.67 xmlrpclib.py,1.19,1.20

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sat, 29 Jun 2002 20:39:16 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13333

Modified Files:
	asynchat.py cgi.py cmd.py mailbox.py imaplib.py multifile.py 
	mutex.py Queue.py threading.py pickle.py xmlrpclib.py 
Log Message:
Code modernization.  Replace v=s[i]; del s[i] with single lookup v=s.pop(i)


Index: asynchat.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** asynchat.py	16 Apr 2002 01:38:39 -0000	1.18
--- asynchat.py	30 Jun 2002 03:39:14 -0000	1.19
***************
*** 270,276 ****
      def pop (self):
          if self.list:
!             result = self.list[0]
!             del self.list[0]
!             return (1, result)
          else:
              return (0, None)
--- 270,274 ----
      def pop (self):
          if self.list:
!             return (1, self.list.pop(0))
          else:
              return (0, None)

Index: cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cgi.py,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -d -r1.73 -r1.74
*** cgi.py	1 Jun 2002 14:18:45 -0000	1.73
--- cgi.py	30 Jun 2002 03:39:14 -0000	1.74
***************
*** 324,329 ****
      """
      plist = map(lambda x: x.strip(), line.split(';'))
!     key = plist[0].lower()
!     del plist[0]
      pdict = {}
      for p in plist:
--- 324,328 ----
      """
      plist = map(lambda x: x.strip(), line.split(';'))
!     key = plist.pop(0).lower()
      pdict = {}
      for p in plist:

Index: cmd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cmd.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** cmd.py	1 Jun 2002 14:18:45 -0000	1.30
--- cmd.py	30 Jun 2002 03:39:14 -0000	1.31
***************
*** 110,115 ****
          while not stop:
              if self.cmdqueue:
!                 line = self.cmdqueue[0]
!                 del self.cmdqueue[0]
              else:
                  if self.use_rawinput:
--- 110,114 ----
          while not stop:
              if self.cmdqueue:
!                 line = self.cmdqueue.pop(0)
              else:
                  if self.use_rawinput:
***************
*** 262,270 ****
          classes = [self.__class__]
          while classes:
!             aclass = classes[0]
              if aclass.__bases__:
                  classes = classes + list(aclass.__bases__)
              names = names + dir(aclass)
-             del classes[0]
          return names
  
--- 261,268 ----
          classes = [self.__class__]
          while classes:
!             aclass = classes.pop(0)
              if aclass.__bases__:
                  classes = classes + list(aclass.__bases__)
              names = names + dir(aclass)
          return names
  

Index: mailbox.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** mailbox.py	1 Jun 2002 14:18:45 -0000	1.37
--- mailbox.py	30 Jun 2002 03:39:14 -0000	1.38
***************
*** 203,208 ****
          if not self.boxes:
              return None
!         fn = self.boxes[0]
!         del self.boxes[0]
          fp = open(os.path.join(self.dirname, fn))
          return self.factory(fp)
--- 203,207 ----
          if not self.boxes:
              return None
!         fn = self.boxes.pop(0)
          fp = open(os.path.join(self.dirname, fn))
          return self.factory(fp)
***************
*** 234,239 ****
          if not self.boxes:
              return None
!         fn = self.boxes[0]
!         del self.boxes[0]
          fp = open(fn)
          return self.factory(fp)
--- 233,237 ----
          if not self.boxes:
              return None
!         fn = self.boxes.pop(0)
          fp = open(fn)
          return self.factory(fp)

Index: imaplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** imaplib.py	24 Jun 2002 23:35:37 -0000	1.53
--- imaplib.py	30 Jun 2002 03:39:14 -0000	1.54
***************
*** 974,982 ****
          if not name in self.untagged_responses:
              return typ, [None]
!         data = self.untagged_responses[name]
          if __debug__:
              if self.debug >= 5:
                  self._mesg('untagged_responses[%s] => %s' % (name, data))
-         del self.untagged_responses[name]
          return typ, data
  
--- 974,981 ----
          if not name in self.untagged_responses:
              return typ, [None]
!         data = self.untagged_responses.pop(name)
          if __debug__:
              if self.debug >= 5:
                  self._mesg('untagged_responses[%s] => %s' % (name, data))
          return typ, data
  

Index: multifile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** multifile.py	5 Oct 2001 21:22:21 -0000	1.20
--- multifile.py	30 Jun 2002 03:39:14 -0000	1.21
***************
*** 161,166 ****
          del self.stack[0]
          if self.seekable:
!             self.start = self.posstack[0]
!             del self.posstack[0]
              if self.level > 0:
                  self.lastpos = abslastpos - self.start
--- 161,165 ----
          del self.stack[0]
          if self.seekable:
!             self.start = self.posstack.pop(0)
              if self.level > 0:
                  self.lastpos = abslastpos - self.start

Index: mutex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mutex.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** mutex.py	4 Apr 2002 22:55:58 -0000	1.10
--- mutex.py	30 Jun 2002 03:39:14 -0000	1.11
***************
*** 45,50 ****
          function with its argument."""
          if self.queue:
!             function, argument = self.queue[0]
!             del self.queue[0]
              function(argument)
          else:
--- 45,49 ----
          function with its argument."""
          if self.queue:
!             function, argument = self.queue.pop(0)
              function(argument)
          else:

Index: Queue.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/Queue.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Queue.py	19 Apr 2002 00:11:31 -0000	1.15
--- Queue.py	30 Jun 2002 03:39:14 -0000	1.16
***************
*** 147,151 ****
      # Get an item from the queue
      def _get(self):
!         item = self.queue[0]
!         del self.queue[0]
!         return item
--- 147,149 ----
      # Get an item from the queue
      def _get(self):
!         return self.queue.pop(0)

Index: threading.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** threading.py	7 Apr 2002 06:36:23 -0000	1.23
--- threading.py	30 Jun 2002 03:39:14 -0000	1.24
***************
*** 634,639 ****
                  self._note("get(): queue empty")
                  self.rc.wait()
!             item = self.queue[0]
!             del self.queue[0]
              self._note("get(): got %s, %d left", item, len(self.queue))
              self.wc.notify()
--- 634,638 ----
                  self._note("get(): queue empty")
                  self.rc.wait()
!             item = self.queue.pop(0)
              self._note("get(): got %s, %d left", item, len(self.queue))
              self.wc.notify()

Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** pickle.py	1 Jun 2002 14:18:46 -0000	1.66
--- pickle.py	30 Jun 2002 03:39:14 -0000	1.67
***************
*** 693,701 ****
  
      def load_binpersid(self):
!         stack = self.stack
! 
!         pid = stack[-1]
!         del stack[-1]
! 
          self.append(self.persistent_load(pid))
      dispatch[BINPERSID] = load_binpersid
--- 693,697 ----
  
      def load_binpersid(self):
!         pid = self.stack.pop()
          self.append(self.persistent_load(pid))
      dispatch[BINPERSID] = load_binpersid
***************
*** 978,983 ****
      def load_append(self):
          stack = self.stack
!         value = stack[-1]
!         del stack[-1]
          list = stack[-1]
          list.append(value)
--- 974,978 ----
      def load_append(self):
          stack = self.stack
!         value = stack.pop()
          list = stack[-1]
          list.append(value)
***************
*** 996,1002 ****
      def load_setitem(self):
          stack = self.stack
!         value = stack[-1]
!         key = stack[-2]
!         del stack[-2:]
          dict = stack[-1]
          dict[key] = value
--- 991,996 ----
      def load_setitem(self):
          stack = self.stack
!         value = stack.pop()
!         key = stack.pop()
          dict = stack[-1]
          dict[key] = value
***************
*** 1015,1020 ****
      def load_build(self):
          stack = self.stack
!         value = stack[-1]
!         del stack[-1]
          inst = stack[-1]
          try:
--- 1009,1013 ----
      def load_build(self):
          stack = self.stack
!         value = stack.pop()
          inst = stack[-1]
          try:
***************
*** 1039,1044 ****
  
      def load_stop(self):
!         value = self.stack[-1]
!         del self.stack[-1]
          raise _Stop(value)
      dispatch[STOP] = load_stop
--- 1032,1036 ----
  
      def load_stop(self):
!         value = self.stack.pop()
          raise _Stop(value)
      dispatch[STOP] = load_stop

Index: xmlrpclib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** xmlrpclib.py	27 Jun 2002 21:36:21 -0000	1.19
--- xmlrpclib.py	30 Jun 2002 03:39:14 -0000	1.20
***************
*** 780,785 ****
  
      def end_array(self, data):
!         mark = self._marks[-1]
!         del self._marks[-1]
          # map arrays to Python lists
          self._stack[mark:] = [self._stack[mark:]]
--- 780,784 ----
  
      def end_array(self, data):
!         mark = self._marks.pop()
          # map arrays to Python lists
          self._stack[mark:] = [self._stack[mark:]]
***************
*** 788,793 ****
  
      def end_struct(self, data):
!         mark = self._marks[-1]
!         del self._marks[-1]
          # map structs to Python dictionaries
          dict = {}
--- 787,791 ----
  
      def end_struct(self, data):
!         mark = self._marks.pop()
          # map structs to Python dictionaries
          dict = {}