From: Sjoerd Mullender Date: Fri, 11 Aug 2000 07:48:36 +0000 (+0000) Subject: Use built in function filter instead of doing it laboriously by hand. X-Git-Tag: v2.0b1~515 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2653a9e07fbbf999774d624adde9e77914ca266;p=thirdparty%2FPython%2Fcpython.git Use built in function filter instead of doing it laboriously by hand. --- diff --git a/Lib/mailbox.py b/Lib/mailbox.py index afd9a5576000..4518e7d0629e 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;