[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.20,1.21 (original) (raw)
Sjoerd Mullender sjoerd@oratrix.nl
Thu, 10 Aug 2000 12:59:06 +0200
- Previous message: [Python-Dev] Python keywords (was Lockstep iteration - eureka !)
- Next message: [Python-Dev] Adding library modules to the core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message: [Python-Dev] Python keywords (was Lockstep iteration - eureka !)
- Next message: [Python-Dev] Adding library modules to the core
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]