Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80960 > unrolled thread

Re: Using map()

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-11-16 23:56 -0700
Last post2014-11-16 23:56 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Using map() Ian Kelly <ian.g.kelly@gmail.com> - 2014-11-16 23:56 -0700

#80960 — Re: Using map()

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-11-16 23:56 -0700
SubjectRe: Using map()
Message-ID<mailman.15946.1416207457.18130.python-list@python.org>
On Sun, Nov 16, 2014 at 4:22 PM, Terry Reedy <tjreedy@udel.edu> wrote:
> If pylint sees 'map(lambda ...: ', it would be appropriate to suggest using
> a comprehension or generator expression instead.  This avoids the unneeded
> creation and repeated call of a new function.

There's actually a separate warning for that: "map/filter on lambda
could be replaced by comprehension (deprecated-lambda)". I agree with
you, though.

On Sun, Nov 16, 2014 at 6:31 PM, Dan Stromberg <drsalists@gmail.com> wrote:
> BTW, I believe in Python 2.x map is like a list comprehension, but in
> 3.x map is like a generator expression.

Yes, just like other functions such as range or dict.items that return
lists in Python 2 but something more light-weight in Python 3.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web