Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #85252

Re: meaning of: line, =

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'anyway.': 0.05; 'say,': 0.05; 'assign': 0.07; 'bits': 0.09; 'literal': 0.09; 'pointers': 0.09; 'references.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'suggest': 0.14; "wouldn't": 0.14; 'behaviour.': 0.16; 'bytecode': 0.16; 'cases)': 0.16; 'created;': 0.16; 'else"': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'seems': 0.21; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'alternate': 0.24; "aren't": 0.24; 'either.': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'forgot': 0.30; 'message-id:@mail.gmail.com': 0.30; 'another': 0.32; "i'd": 0.34; 'could': 0.34; "can't": 0.35; 'created': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'yield': 0.36; 'list': 0.37; 'whatever': 0.38; 'pm,': 0.38; 'that,': 0.38; 'most': 0.60; 'new': 0.61; "you're": 0.61; 'places': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'anything.': 0.68; 'to,': 0.72; '2015': 0.84; 'otten': 0.84; '1:18': 0.91; 'notion': 0.91
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=eKh4zIYyZTI/X9l4vtp8lPQU8rvdR9XoK2wiG0/Z6Y4=; b=UBNLkmm9kF+w0ITx9XV63YTml+rXdxdYUOd29d2OXQy9yJMF7g38O+F1zPS2r0NwLL tD0dGNmA16jkO2OnLArs3SyFU5xCQxxijWHRA+rkyRCHTM7UvBwSvtXr429xSQDUQwiL Ft2i87ey+sK2ufXEOPsqSil4Od25VRP9+dsMrO6PVWbtThV4bGWqYBNbNetwSPBWHdBC LX15Ah4SRTpIreJriDJ7wU60pzAuR84U6rnVs0GvtWS3NwduNBTbVBmdMBr3iJyPXVYq fSRQXpJkUl2zwUyej//mCaF08yxPfGCOt7O4hNDtKEeTr22ashNJIZGLNYD2GvYJySK+ Ek3w==
X-Received by 10.229.114.74 with SMTP id d10mr6204694qcq.5.1423127449564; Thu, 05 Feb 2015 01:10:49 -0800 (PST)
MIME-Version 1.0
In-Reply-To <CAPTjJmp=b2ZA8eqvyf3tqK+0MHqOgS-PAG+ELNNOwuKKPq4FJQ@mail.gmail.com>
References <CAPTjJmpqx1Cmm89Lg6-XL4-xdM+xD6=GHKvWb2zYTe4=11ZPPg@mail.gmail.com> <mailman.18464.1423061056.18130.python-list@python.org> <07f4498c-7917-4315-85d4-73283a830f2d@googlegroups.com> <matlbh$r0s$1@ger.gmane.org> <CAPTjJmp=b2ZA8eqvyf3tqK+0MHqOgS-PAG+ELNNOwuKKPq4FJQ@mail.gmail.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Thu, 5 Feb 2015 01:10:09 -0800
Subject Re: meaning of: line, =
To Chris Angelico <rosuav@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18488.1423127457.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1423127457 news.xs4all.nl 2833 [2001:888:2000:d::a6]:52822
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:85252

Show key headers only | View raw


On Wed, Feb 4, 2015 at 1:18 PM, Chris Angelico <rosuav@gmail.com> wrote:
> 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.

Nor are most people. Nor is Python, in some places -- it seems like
people forgot about it when writing some bits of the grammar.

I'd suggest not using it.

>> (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.

C pointers don't do that either. It's really just references. (C
pointers aren't any more action-at-a-distance than Python attributes.)

Anyway, it could create a new list in Python, because Python can do
whatever it wants. But it doesn't, because as you say, that wouldn't
do anything.

-- Devin

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: meaning of: line, = Albert-Jan Roskam <fomcl@yahoo.com> - 2015-02-04 14:38 +0000
  Re: meaning of: line, = Rustom Mody <rustompmody@gmail.com> - 2015-02-04 07:09 -0800
    Re: meaning of: line, = Peter Otten <__peter__@web.de> - 2015-02-04 18:36 +0100
    Re: meaning of: line, = Chris Angelico <rosuav@gmail.com> - 2015-02-05 08:18 +1100
    Re: meaning of: line, = Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-02-05 01:10 -0800
      Re: meaning of: line, = Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-05 20:40 +1100
        Re: meaning of: line, = Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-05 09:08 -0700
          Re: meaning of: line, = Rustom Mody <rustompmody@gmail.com> - 2015-02-05 08:45 -0800
            Re: meaning of: line, = Skip Montanaro <skip.montanaro@gmail.com> - 2015-02-05 10:56 -0600
            Re: meaning of: line, = Tim Chase <python.list@tim.thechases.com> - 2015-02-05 11:00 -0600
            Re: meaning of: line, = Rustom Mody <rustompmody@gmail.com> - 2015-02-05 08:59 -0800
              Re: meaning of: line, = Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-02-06 05:09 -0800
                Re: meaning of: line, = Rustom Mody <rustompmody@gmail.com> - 2015-02-06 05:20 -0800
                Re: meaning of: line, = Rustom Mody <rustompmody@gmail.com> - 2015-02-06 06:03 -0800
        Re: meaning of: line, = Tim Chase <python.list@tim.thechases.com> - 2015-02-05 10:21 -0600
        Re: meaning of: line, = Devin Jeanpierre <jeanpierreda@gmail.com> - 2015-02-05 17:12 -0800
        Re: meaning of: line, = Chris Angelico <rosuav@gmail.com> - 2015-02-06 12:17 +1100
          Re: meaning of: line, = Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-02-06 17:52 +1300
      Re: meaning of: line, = Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-02-06 12:30 +1300

csiph-web