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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.064 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.01; 'subject:code': 0.07; 'function,': 0.09; 'doing,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'tells': 0.24; 'fine': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'probably': 0.32; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'sometimes': 0.38; 'mapping': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'name': 0.63; 'map': 0.64; 'same,': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=cb8vNGhsT63DFN6kw9S2JwKJ6L4UKO0U6YWB9agZ+oA=; b=s0dSHsxZJIpA4hfFAGWw+TcbouSUy+FONwE0GesQW1PPa5bE8V710PLLPBweIIHkTG 7aMw40/CScHqAD6qHIhzIVStdIUsLgGmvoaW8WaI6z/aOwRP9TomAfSW3GAk5MibBoOL zkOMW10PnZ7O1g4w19xyzDL+avkWoA9aAi1UaxS4mtSYbHdywH11UZsOBcG4cmRUSIk+ hQnfoU0c+tYOZPZ5e21MQ8TrOZ/HpfU5R5m1uT8KMhaRzfo0iENW/rf4Tc8OgyaJttqN KR9XFDDX16Wt+IeLqUI4Ersb1PJq2OAelmul/5cCyhfPCx5ar7XJHo+mU9lznmNggBDd cstw== MIME-Version: 1.0 X-Received: by 10.58.67.9 with SMTP id j9mr15501985vet.3.1383989308556; Sat, 09 Nov 2013 01:28:28 -0800 (PST) In-Reply-To: <729e093a-6312-44dc-8ed4-1dd5ea344066@googlegroups.com> References: <729e093a-6312-44dc-8ed4-1dd5ea344066@googlegroups.com> Date: Sat, 9 Nov 2013 20:28:28 +1100 Subject: Re: my favorite line of py code so far From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1383989316 news.xs4all.nl 15883 [2001:888:2000:d::a6]:36161 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:58922 On Sat, Nov 9, 2013 at 8:23 PM, Peter Cacioppi wrote: > I sometimes use map, sometimes comprehensions. I suspect other people do the same, that's why the language supports map and comprehensions. I think map is fine if you can use a named function, but if you can't come up with a descriptive name for what you're doing, a comprehension is probably better (as it'll have the code right there). Mapping _ across everything tells you nothing about what it's actually doing. ChrisA