[Python-Dev] benchmarks: Force map to a list to guarantee the calculations are performed under (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Mon Oct 1 01:11:04 CEST 2012
- Previous message: [Python-Dev] Stdlib and timezones, again
- Next message: [Python-Dev] benchmarks: Force map to a list to guarantee the calculations are performed under
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 1 Oct 2012 01:00:42 +0200 (CEST) brett.cannon <python-checkins at python.org> wrote:
http://hg.python.org/benchmarks/rev/e9f911fd9bd3 changeset: 184:e9f911fd9bd3 user: Brett Cannon <brett at python.org> date: Sun Sep 30 19:00:32 2012 -0400 summary: Force map to a list to guarantee the calculations are performed under Python 3. [...] def evaltimesu(func, u): - return map(func, ((i,u) for i in xrange(len(list(u))))) + return list(imap(func, ((i,u) for i in xrange(len(list(u))))))
Ugh, can't you use a list comprehension instead? The code would be much more idiomatic.
Regards
Antoine.
-- Software development and contracting: http://pro.pitrou.net
- Previous message: [Python-Dev] Stdlib and timezones, again
- Next message: [Python-Dev] benchmarks: Force map to a list to guarantee the calculations are performed under
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]