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

Sjoerd Mullender python-dev@python.org
Thu, 10 Aug 2000 12:59:06 +0200


On Wed, Aug 9 2000 Guido van Rossum wrote:

>           files = os.listdir(self.dirname)
> !         list = []
>           for f in files:
>               if pat.match(f):
> !                 list.append(f)
> !         list = map(long, list)
> !         list.sort()

Isn't this just:
	list = os.listdir(self.dirname)
	list = filter(pat.match, list)
	list = map(long, list)
	list.sort()

Or even shorter:
	list = map(long, filter(pat.match, os.listdir(self.dirname)))
	list.sort()
(Although I can and do see the advantage of the slightly longer
version.)

-- Sjoerd Mullender <sjoerd.mullender@oratrix.com>