summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/Queue.py4
-rw-r--r--Lib/asynchat.py4
-rwxr-xr-xLib/cgi.py3
-rw-r--r--Lib/cmd.py6
-rw-r--r--Lib/imaplib.py3
-rwxr-xr-xLib/mailbox.py6
-rw-r--r--Lib/multifile.py3
-rw-r--r--Lib/mutex.py3
-rw-r--r--Lib/pickle.py20
-rw-r--r--Lib/threading.py3
-rw-r--r--Lib/xmlrpclib.py6
11 files changed, 19 insertions, 42 deletions
diff --git a/Lib/Queue.py b/Lib/Queue.py
index de7be72d7a..cd035da14c 100644
--- a/Lib/Queue.py
+++ b/Lib/Queue.py
@@ -146,6 +146,4 @@ class Queue:
# Get an item from the queue
def _get(self):
- item = self.queue[0]
- del self.queue[0]
- return item
+ return self.queue.pop(0)
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index e1c97949b0..1ba6b15b91 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -269,9 +269,7 @@ class fifo:
def pop (self):
if self.list:
- result = self.list[0]
- del self.list[0]
- return (1, result)
+ return (1, self.list.pop(0))
else:
return (0, None)
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 88d419e0dd..5f4bad3c8b 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -323,8 +323,7 @@ def parse_header(line):
"""
plist = map(lambda x: x.strip(), line.split(';'))
- key = plist[0].lower()
- del plist[0]
+ key = plist.pop(0).lower()
pdict = {}
for p in plist:
i = p.find('=')
diff --git a/Lib/cmd.py b/Lib/cmd.py
index f20c1bb7aa..6d9efff080 100644
--- a/Lib/cmd.py
+++ b/Lib/cmd.py
@@ -109,8 +109,7 @@ class Cmd:
stop = None
while not stop:
if self.cmdqueue:
- line = self.cmdqueue[0]
- del self.cmdqueue[0]
+ line = self.cmdqueue.pop(0)
else:
if self.use_rawinput:
try:
@@ -261,11 +260,10 @@ class Cmd:
names = []
classes = [self.__class__]
while classes:
- aclass = classes[0]
+ aclass = classes.pop(0)
if aclass.__bases__:
classes = classes + list(aclass.__bases__)
names = names + dir(aclass)
- del classes[0]
return names
def complete_help(self, *args):
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 0817da9d23..ed03c56e41 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -973,11 +973,10 @@ class IMAP4:
return typ, dat
if not name in self.untagged_responses:
return typ, [None]
- data = self.untagged_responses[name]
+ data = self.untagged_responses.pop(name)
if __debug__:
if self.debug >= 5:
self._mesg('untagged_responses[%s] => %s' % (name, data))
- del self.untagged_responses[name]
return typ, data
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 7afff50012..1834177f70 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -202,8 +202,7 @@ class MHMailbox:
def next(self):
if not self.boxes:
return None
- fn = self.boxes[0]
- del self.boxes[0]
+ fn = self.boxes.pop(0)
fp = open(os.path.join(self.dirname, fn))
return self.factory(fp)
@@ -233,8 +232,7 @@ class Maildir:
def next(self):
if not self.boxes:
return None
- fn = self.boxes[0]
- del self.boxes[0]
+ fn = self.boxes.pop(0)
fp = open(fn)
return self.factory(fp)
diff --git a/Lib/multifile.py b/Lib/multifile.py
index ff7dbf6b14..4ef364451d 100644
--- a/Lib/multifile.py
+++ b/Lib/multifile.py
@@ -160,8 +160,7 @@ class MultiFile:
self.level = max(0, self.level - 1)
del self.stack[0]
if self.seekable:
- self.start = self.posstack[0]
- del self.posstack[0]
+ self.start = self.posstack.pop(0)
if self.level > 0:
self.lastpos = abslastpos - self.start
diff --git a/Lib/mutex.py b/Lib/mutex.py
index 47d2ca2371..e15710a908 100644
--- a/Lib/mutex.py
+++ b/Lib/mutex.py
@@ -44,8 +44,7 @@ class mutex:
"""Unlock a mutex. If the queue is not empty, call the next
function with its argument."""
if self.queue:
- function, argument = self.queue[0]
- del self.queue[0]
+ function, argument = self.queue.pop(0)
function(argument)
else:
self.locked = 0
diff --git a/Lib/pickle.py b/Lib/pickle.py
index f29df510a2..e553920b12 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -692,11 +692,7 @@ class Unpickler:
dispatch[PERSID] = load_persid
def load_binpersid(self):
- stack = self.stack
-
- pid = stack[-1]
- del stack[-1]
-
+ pid = self.stack.pop()
self.append(self.persistent_load(pid))
dispatch[BINPERSID] = load_binpersid
@@ -977,8 +973,7 @@ class Unpickler:
def load_append(self):
stack = self.stack
- value = stack[-1]
- del stack[-1]
+ value = stack.pop()
list = stack[-1]
list.append(value)
dispatch[APPEND] = load_append
@@ -995,9 +990,8 @@ class Unpickler:
def load_setitem(self):
stack = self.stack
- value = stack[-1]
- key = stack[-2]
- del stack[-2:]
+ value = stack.pop()
+ key = stack.pop()
dict = stack[-1]
dict[key] = value
dispatch[SETITEM] = load_setitem
@@ -1014,8 +1008,7 @@ class Unpickler:
def load_build(self):
stack = self.stack
- value = stack[-1]
- del stack[-1]
+ value = stack.pop()
inst = stack[-1]
try:
setstate = inst.__setstate__
@@ -1038,8 +1031,7 @@ class Unpickler:
dispatch[MARK] = load_mark
def load_stop(self):
- value = self.stack[-1]
- del self.stack[-1]
+ value = self.stack.pop()
raise _Stop(value)
dispatch[STOP] = load_stop
diff --git a/Lib/threading.py b/Lib/threading.py
index 491a7c0b09..0af193b8fa 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -633,8 +633,7 @@ def _test():
while not self.queue:
self._note("get(): queue empty")
self.rc.wait()
- item = self.queue[0]
- del self.queue[0]
+ item = self.queue.pop(0)
self._note("get(): got %s, %d left", item, len(self.queue))
self.wc.notify()
self.mon.release()
diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py
index 0eb9f3f073..4b6fc43cff 100644
--- a/Lib/xmlrpclib.py
+++ b/Lib/xmlrpclib.py
@@ -779,16 +779,14 @@ class Unmarshaller:
dispatch["name"] = end_string # struct keys are always strings
def end_array(self, data):
- mark = self._marks[-1]
- del self._marks[-1]
+ mark = self._marks.pop()
# map arrays to Python lists
self._stack[mark:] = [self._stack[mark:]]
self._value = 0
dispatch["array"] = end_array
def end_struct(self, data):
- mark = self._marks[-1]
- del self._marks[-1]
+ mark = self._marks.pop()
# map structs to Python dictionaries
dict = {}
items = self._stack[mark:]