Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.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; 'anyway.': 0.05; 'assign': 0.07; 'literal': 0.09; 'pointers': 0.09; 'references.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'behaviour.': 0.16; 'bytecode': 0.16; 'cases)': 0.16; 'created;': 0.16; 'else"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'alternate': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'another': 0.32; 'could': 0.34; "can't": 0.35; 'created': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'yield': 0.36; 'list': 0.37; 'that,': 0.38; "you're": 0.61; 'to,': 0.72; '2015': 0.84; 'otten': 0.84; 'notion': 0.91; 'to:none': 0.92 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:cc :content-type; bh=ayGM1pcB+OUqzEQMyIkyooo2T7rJ+9HI7txfQhgJlhA=; b=N+iV7LbCDhp2Z+/JzZuoqhGktkyPRMcZXse5rOQO4hCYo0dTSAOxOm3A8PId88gMQN UAdrG3ENaWGhSigTUN0l1lwuM7BrYAiz9mlKbvJe4Dlu4I/qi6HNZLeseYGHytdrhIQd NNQvI+LM/9dUHgS4jilHXLQvSKTnj9trKcFDpw+usb8DZfRjyqf2dg4qBzd+GnaqIQ+y zKtTMjIbSfKHwrJ8d8A3JhBRKpGw1k3FgrM3+NnFaLPDv23c1hcSlj/R6S1NOzJA+THT jugIM8+VBlDqqFGKAbugY4zUrsN5jniHI6RDdjV3RcjqHGDy94+1zrGGdN/Z8S+TM1IF MCEg== MIME-Version: 1.0 X-Received: by 10.107.167.201 with SMTP id q192mr374047ioe.43.1423084719391; Wed, 04 Feb 2015 13:18:39 -0800 (PST) In-Reply-To: References: <07f4498c-7917-4315-85d4-73283a830f2d@googlegroups.com> Date: Thu, 5 Feb 2015 08:18:39 +1100 Subject: Re: meaning of: line, = From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423084727 news.xs4all.nl 2914 [2001:888:2000:d::a6]:57704 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85233 On Thu, Feb 5, 2015 at 4:36 AM, Peter Otten <__peter__@web.de> wrote: > Another alternative is to put a list literal on the lefthand side: > >>>> def f(): yield 42 > > ... >>>> [result] = f() >>>> result > 42 Huh, was not aware of that alternate syntax. > (If you're worried: neither the list nor the tuple will be created; the > bytecode is identical in both cases) It can't possibly be created anyway. Python doesn't have a notion of "assignable thing that, when assigned to, will assign to something else" like C's pointers or C++'s references. There's nothing that you could put into the list that would have this behaviour. ChrisA