Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Convert list to another form but providing same information Date: Mon, 21 Mar 2016 14:14:23 -0600 Lines: 8 Message-ID: References: <1010f2cb-21f9-495b-8af4-03ad209b4c1e@googlegroups.com> <87bn67oayt.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de VIbM38WchXYkMMoQOIjd5QmVmDuiHim6yEyJ07fDxWZQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '21,': 0.07; 'subject:form': 0.07; '(actually': 0.09; 'subject:same': 0.09; '2016': 0.16; 'lambda': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:Convert': 0.16; 'url:faq': 0.16; 'wrote:': 0.16; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'subject:list': 0.26; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; "can't": 0.32; 'statement': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'wanted': 0.37; 'received:209': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'url:3': 0.60; 'here:': 0.63; 'mar': 0.65; 'experts': 0.70; 'to:name:python': 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; bh=IwY+w9HPCiCTEi4BfM4AtUC0i+tPjHd2FCixTdC0Mmc=; b=FHoU23K8FVAS3B04PoT/aPLOrkU4MjcWUIYRj0bIG7aubbd0VLcNTcL0IAw+ZX+3o0 LRsT1ekr6gcR8BRkcKSVWpaS/O3wAkJ8UcSC0RAKWulOLwHZrCUVTTJlEIby8u/OsCb6 XT7rma/5Wx5VRX98agM9OO+N9hBjSZBsrx4koq27CliYIlu7VcbVYKOHp4LQlnzChpwR 7WJI69OA5a27fKGEMru7JAMbc1XFHGoj5XGuEQoOIMdW8qztRe8JEwlptRxMJ8wnMkS+ jk+8f9rFd225SBWWgUhO0P6Q2PLBzLQhV7HVMOnSuQrd+Fz75Zc4P+3aBHcoxTMNWmFw QAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=IwY+w9HPCiCTEi4BfM4AtUC0i+tPjHd2FCixTdC0Mmc=; b=KBr7UQMJeHIGNjVFCfCFvpqmOCN7UPQ199esM1jXBl+q0C0R5s04dTo4Vn230y7S2Q w+iThIHuq0BZ2YU7QnZYSiXjuLpSDFyi7nNKtrv+yD8EWgNxlsi7mzhmTlpor2o6FD25 Pb0PbdrMp+b/x/Kkk3kBrEW/A6n6AUfKPY461bCJ1jXH5JUagACplL6EC46Xsq8/3CFC r/pNv0SKXcHhbzTn38f9XXUWBrIH6UGqrzMV9oZnQzoDJkQwtXmM4RDl9ZNxu2Wc1DGD rQUfBa0ghzkzopvwJFdXZjoJnd1BRbt54i4ln7Ne7v/RIRxGQdyn+GYtvTekHPmiRIWY co5A== X-Gm-Message-State: AD7BkJIknwqopRfSFe8vLyb4V4LgFKXpq0A/A6VD8TbvAg/grE2tj1sVBSzZ80pqA8C8224uMpRiOuZ4Y8GtXw== X-Received: by 10.50.72.107 with SMTP id c11mr14823335igv.85.1458591302460; Mon, 21 Mar 2016 13:15:02 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105403 On Mon, Mar 21, 2016 at 2:12 PM, Ian Kelly wrote: > On Mon, Mar 21, 2016 at 2:03 PM, Ben Bacarisse wrote: >> For experts here: why can't I write a lambda that has a statement in it >> (actually I wanted two: lambda l, i: l[i] += 1; return l)? > > https://docs.python.org/3/faq/design.html#why-can-t-lambda-expressions-contain-statements tl;dr: If you want a function with a statement in it, use def, not lambda.