summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-02-07 02:16:24 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-02-07 02:16:24 (GMT)
commitb5ba8d749d66403edab1eaf9f3f83006134c0a67 (patch)
tree3b77209f9fbdfab5efbf3fd7c372a51acc83fc73
parent3ba85c2e8a2e25dcbc737edca43759756bcd291e (diff)
downloadcpython-b5ba8d749d66403edab1eaf9f3f83006134c0a67.zip
cpython-b5ba8d749d66403edab1eaf9f3f83006134c0a67.tar.gz
cpython-b5ba8d749d66403edab1eaf9f3f83006134c0a67.tar.bz2
Lists work better when popping from the right.
-rwxr-xr-xLib/mailbox.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index d3c8ec8..258b657 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -199,6 +199,7 @@ class MHMailbox:
# This only works in Python 1.6 or later;
# before that str() added 'L':
self.boxes = map(str, list)
+ self.boxes.reverse()
self.factory = factory
def __iter__(self):
@@ -207,7 +208,7 @@ class MHMailbox:
def next(self):
if not self.boxes:
return None
- fn = self.boxes.pop(0)
+ fn = self.boxes.pop()
fp = open(os.path.join(self.dirname, fn))
msg = self.factory(fp)
try:
@@ -233,7 +234,7 @@ class Maildir:
curdir = os.path.join(self.dirname, 'cur')
boxes += [os.path.join(curdir, f)
for f in os.listdir(curdir) if f[0] != '.']
-
+ boxes.reverse()
self.boxes = boxes
def __iter__(self):
@@ -242,7 +243,7 @@ class Maildir:
def next(self):
if not self.boxes:
return None
- fn = self.boxes.pop(0)
+ fn = self.boxes.pop()
fp = open(fn)
return self.factory(fp)