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


Groups > comp.lang.python > #80960

Re: Using map()

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; '16,': 0.03; 'dan': 0.09; 'repeated': 0.09; 'subject:()': 0.09; 'python': 0.11; 'suggest': 0.14; 'expression.': 0.16; 'lambda': 0.16; 'reedy': 0.16; 'sees': 0.16; 'unneeded': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'separate': 0.22; '2.x': 0.24; 'instead.': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '3.x': 0.31; 'though.': 0.31; 'lists': 0.32; 'could': 0.34; 'agree': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'list': 0.37; 'nov': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'expression': 0.60; 'new': 0.61; 'range': 0.61; 'such': 0.63; 'map': 0.64; 'more': 0.64; 'believe': 0.68; 'avoids': 0.84; 'light-weight': 0.84; 'subject:Using': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=c/Ou9NtOEIwbl8rNHPGkQDXCm6Of0q3xzfMnIsMMbPQ=; b=K7m0sMi8myyXnaRYSID60LE4jDYY1xcTwtqNysL8GJjAJFZnXl9kZt+TG2PwdzJslV V/rky0Beds01n4UN0o/v2FZc2zHPALnomdhfJr2zok8J2HgEZz9KHS+zUeUYD0aa3jJ9 NQY/FF1OAB8Pyey3htYw/iXRe15xhttAgw37gCcabF5Mvx+KIiVrZwezGfK4A3xlwNoE iZkrbb2/TOxiX09Ss83aX3MpEuYXOJpy1hYW0gg2tTwXQrsYkWRKz4Dro+mX6gameQtf 59uWpP5AnshVw5GXG0XJEtVbnXBDbYrMcHQC7h512/2VBkvhyxUKi9TP4ddBEuLw2jdC r5GA==
X-Received by 10.70.100.199 with SMTP id fa7mr27676233pdb.114.1416207447793; Sun, 16 Nov 2014 22:57:27 -0800 (PST)
MIME-Version 1.0
In-Reply-To <m4bbjd$76j$1@ger.gmane.org>
References <3b3e245f-c377-4543-b9eb-186e5087103a@lists.xtsubasa.org> <m4bbjd$76j$1@ger.gmane.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 16 Nov 2014 23:56:47 -0700
Subject Re: Using map()
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15946.1416207457.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416207457 news.xs4all.nl 2978 [2001:888:2000:d::a6]:41321
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80960

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web