Kaydet (Commit) d2653a9e authored tarafından Sjoerd Mullender's avatar Sjoerd Mullender

Use built in function filter instead of doing it laboriously by hand.

üst 1d3e239f
...@@ -157,11 +157,10 @@ class MHMailbox: ...@@ -157,11 +157,10 @@ class MHMailbox:
import re import re
pat = re.compile('^[1-9][0-9]*$') pat = re.compile('^[1-9][0-9]*$')
self.dirname = dirname self.dirname = dirname
files = os.listdir(self.dirname) # the three following lines could be combined into:
list = [] # list = map(long, filter(pat.match, os.listdir(self.dirname)))
for f in files: list = os.listdir(self.dirname)
if pat.match(f): list = filter(pat.match, list)
list.append(f)
list = map(long, list) list = map(long, list)
list.sort() list.sort()
# This only works in Python 1.6 or later; # This only works in Python 1.6 or later;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment