Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'syntax': 0.04; 'explicitly': 0.05; 'assign': 0.07; 'referring': 0.07; 'bits': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; '(),': 0.16; '(b,': 0.16; 'blacklist': 0.16; 'blacklists': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'seems': 0.21; 'feb': 0.22; '>>>': 0.22; 'example': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'alternate': 0.24; 'exists': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'forgot': 0.30; 'message- id:@mail.gmail.com': 0.30; '"",': 0.31; '>>>>': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'another': 0.32; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'example,': 0.37; 'pm,': 0.38; 'either': 0.39; 'ian': 0.60; 'most': 0.60; 'first': 0.61; 'places': 0.64; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'invalid': 0.68; '2015': 0.84; '1:18': 0.91; 'differences': 0.93 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=vb4N5EQA4GPtmje/dpMp9hfmLHikRJoKl/4Jc9mdnIw=; b=YRBADczRG4rc3v4IA2P+I/KTiuee4HTkIPQrD5lYyA61Q8zfNG2y6pcvGKkKfahiJ4 9YsRCzZB3Vd6GaShKlLpO9FuTegh4vVKFogjhAn7d32qOX13vk5iS6Qwp7tMWaSbE4gn zsWHmG+cbv69DJ50PnSOcYF1hNQm9OTGMGII4XjPzfgPKNFhzrXM8ZWTM4GrGmVAm/+G ny/d8O8uOh6XYrGJD5mV/6JIBtEhcTf8OpToyiEzp8KNq19DLs+YOXNmvlWfevmZ7Csw SSTf0F1P02MtwHiaEIN0xt8ijWuCjQPy8quvQSwjvZT6tkaIq3CXqMVthhPcrdqoPZOY hWww== X-Received: by 10.224.37.72 with SMTP id w8mr2551684qad.58.1423185177480; Thu, 05 Feb 2015 17:12:57 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <07f4498c-7917-4315-85d4-73283a830f2d@googlegroups.com> <54d33aa6$0$13003$c3e8da3$5496439d@news.astraweb.com> From: Devin Jeanpierre Date: Thu, 5 Feb 2015 17:12:17 -0800 Subject: Re: meaning of: line, = To: Ian Kelly Content-Type: text/plain; charset=UTF-8 Cc: Python 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423185179 news.xs4all.nl 2880 [2001:888:2000:d::a6]:35018 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85276 On Thu, Feb 5, 2015 at 8:08 AM, Ian Kelly wrote: > On Thu, Feb 5, 2015 at 2:40 AM, Steven D'Aprano > wrote: >> Devin Jeanpierre wrote: >>> On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico wrote: >>>>>>>> [result] = f() >>>>>>>> result >>>>> 42 >>>> >>>> Huh, was not aware of that alternate syntax. >>> >>> Nor are most people. Nor is Python, in some places -- it seems like >>> people forgot about it when writing some bits of the grammar. >> >> Got an example where you can use a,b but not [a,b] or (a,b)? > >>>> def f(a, (b, c)): > ... print a, b, c > ... >>>> f(3, [4, 5]) > 3 4 5 >>>> def g(a, [b, c]): > File "", line 1 > def g(a, [b, c]): > ^ > SyntaxError: invalid syntax > > Although to be fair, the first syntax there is no longer valid either > in Python 3. As Ian rightly understood, I was referring to differences between "[a, b, ...]" and "(a, b, ...)". Here's another example, one that still exists in Python 3: >>> [] = '' >>> () = '' File "", line 1 SyntaxError: can't assign to () The syntax explicitly blacklists (), but forgets to blacklist []. -- Devin