[Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.21,1.22

Sjoerd Mullender python-dev@python.org
Fri, 11 Aug 2000 00:48:39 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv20051

Modified Files:
	mailbox.py 
Log Message:
Use built in function filter instead of doing it laboriously by hand.


Index: mailbox.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** mailbox.py	2000/08/10 03:05:26	1.21
--- mailbox.py	2000/08/11 07:48:36	1.22
***************
*** 158,166 ****
          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)
          list = map(long, list)
          list.sort()
--- 158,165 ----
          pat = re.compile('^[1-9][0-9]*$')
          self.dirname = dirname
!         # 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()