Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; '[1]:': 0.09; '[2]:': 0.09; 'accepted,': 0.09; 'cc:addr:python-list': 0.11; '(1,': 0.16; '(x,': 0.16; '2],': 0.16; 'brackets.': 0.16; 'cc:name:python list': 0.16; 'extraneous': 0.16; 'lambda': 0.16; 'parentheses': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'seems': 0.21; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; 'related': 0.29; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; '"",': 0.31; '3.x': 0.31; 'file': 0.32; 'guess': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'i.e.': 0.36; 'removing': 0.60; 'kind': 0.63; 'to:addr:gmail.com': 0.65; 'invalid': 0.68; 'removal': 0.74; 'oscar': 0.84; '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:from:date:message-id:subject:to :cc:content-type; bh=47m+fKz/OR5C1fMPpSA8IITmWxLCYpfLoTVnUW/P0eU=; b=awveI0CDH7HehIOBMZcrpx/XnU4YABBHowaqrj7RS6nqZivSWDXHRps+ggxa9ULXfz NABqP/bIsWPOjXG8OFTgK5eYOXXDCPTy9MsfQccyKH8hpLaAjLt8a3QrkLZaSwBkyEY1 90Lpgt5bIAskDpm0x29Agb0lT+0eWC4JKIOXuTth21CNBGJQVT8ge0T41qtFmEGgBlIa WR7Kaxq5oTowkFRvx7vwnkLvrA7Cr0TtYzr7c074jLeCc6QT6Y1tQ03v1ECrqOnH9o8y WJW898G2P6t5EveGwKpeWKc+YSkyBZ20qvjUNSCCJEZcfN9E0NgYbdGiREKoZvQ8w1g8 oAyg== X-Received: by 10.58.100.144 with SMTP id ey16mr1212345veb.25.1378905102973; Wed, 11 Sep 2013 06:11:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Oscar Benjamin Date: Wed, 11 Sep 2013 14:11:22 +0100 Subject: Re: why syntax change in lambda To: Neal Becker Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378905112 news.xs4all.nl 15985 [2001:888:2000:d::a6]:53611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53963 On 11 September 2013 14:03, Neal Becker wrote: > In py2.7 this was accepted, but not in py3.3. Is this intentional? It seems to > violate the 'principle' that extraneous parentheses are usually allowed/ignored > > In [1]: p = lambda x: x > > In [2]: p = lambda (x): x > File "", line 1 > p = lambda (x): x > ^ > SyntaxError: invalid syntax I guess it's related to the removal of auto-unpacking of arguments. i.e. in 2.x: >>> f = lambda (x, y), z: (x, y, z) >>> f([1, 2], 3) (1, 2, 3) However this was removed in 3.x so >>> f = lambda (x, y), z: (x, y, z) File "", line 1 f = lambda (x, y), z: (x, y, z) ^ SyntaxError: invalid syntax Removing that feature would allow a simplification of the lambda syntax that would have no need to admit any kind of brackets. Oscar