A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008125.html below:

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

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.20,1.21 [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.20,1.21Sjoerd Mullender sjoerd@oratrix.nl
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>



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4