summaryrefslogtreecommitdiffstats
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>2000-08-11 07:48:36 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>2000-08-11 07:48:36 (GMT)
commitd2653a9e07fbbf999774d624adde9e77914ca266 (patch)
tree7517b6ef8e2beaf68c94f260d14d71b42f84f440 /Lib/mailbox.py
parent1d3e239f0804537c5d5f0333d3a3287dd57f784d (diff)
downloadcpython-d2653a9e07fbbf999774d624adde9e77914ca266.zip
cpython-d2653a9e07fbbf999774d624adde9e77914ca266.tar.gz
cpython-d2653a9e07fbbf999774d624adde9e77914ca266.tar.bz2
Use built in function filter instead of doing it laboriously by hand.
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-xLib/mailbox.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index afd9a55..4518e7d 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -157,11 +157,10 @@ class MHMailbox:
import re
pat = re.compile('^[1-9][0-9]*$')
self.dirname = dirname
- files = os.listdir(self.dirname)
- list = []
- for f in files:
- if pat.match(f):
- list.append(f)
+ # the three following lines could be combined into:
+ # list = map(long, filter(pat.match, os.listdir(self.dirname)))
+ list = os.listdir(self.dirname)
+ list = filter(pat.match, list)
list = map(long, list)
list.sort()
# This only works in Python 1.6 or later;