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


Groups > comp.lang.python > #81426

Re: Comprehension with two variables - explanation needed

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.085
X-Spam-Evidence '*H*': 0.84; '*S*': 0.01; 'cpython': 0.05; 'subject:two': 0.07; 'global,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'increment': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'byte': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'says': 0.33; 'could': 0.34; 'subject:with': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'nov': 0.38; 'subject:needed': 0.38; 'pm,': 0.38; 'even': 0.60; 'above,': 0.60; 'hope': 0.61; 'break': 0.61; 'subject:skip:C 10': 0.61; 'today': 0.64; 'anything.': 0.68; 'grow': 0.77; 'different.': 0.84; "it'd": 0.84; 'local,': 0.84; 'to:none': 0.92; 'tomorrow': 0.95
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=nxHjw5ly4rQAqnOJWrLtPmFSCIoU0uXsYdBAyShUbUw=; b=IZS37ur44WdLvzn7Gj0+WE8lRQ/3StV206cLPhIutUS3ZkcGAoCsJau71m4U+KaQTd qt9fwWXAplAorfEl6sWFLNO9j69RmBGwcAR2aWZMt87TBBqWuWifIYo2s9LFpqyRpDKm KTBiSphghiwpj0b4oyMKXB9D7DzwnRZUkQonCQ6wDRRP1zq+vZwNRrgx5Zr3Vu4s59Us 6cIB+Jdhakqhy6Br++Zm2oDfgwdk2tuFv37ypIvYKG0avJWkjqV5+BOkZj6aI8PNXesW gXvfYW8ccPOJAdaTrSKyuuQ3vqCV0m5DO1+RGMaSt+Hb9JCcA2y158GtIIa8hT9C3qtq UQAA==
MIME-Version 1.0
X-Received by 10.50.152.104 with SMTP id ux8mr9716120igb.14.1416804693922; Sun, 23 Nov 2014 20:51:33 -0800 (PST)
In-Reply-To <5472b74d$0$12979$c3e8da3$5496439d@news.astraweb.com>
References <mailman.16184.1416754678.18130.python-list@python.org> <d1194d28-e9ed-4bd3-86e9-899e13a17097@googlegroups.com> <002501d00733$6995dce0$3cc196a0$@gmail.com> <mailman.16191.1416757555.18130.python-list@python.org> <roy-B11F64.10563923112014@news.panix.com> <07f25264-1286-4d98-820c-949dba711248@googlegroups.com> <5472b74d$0$12979$c3e8da3$5496439d@news.astraweb.com>
Date Mon, 24 Nov 2014 15:51:33 +1100
Subject Re: Comprehension with two variables - explanation needed
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <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.16222.1416804702.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416804702 news.xs4all.nl 2922 [2001:888:2000:d::a6]:56586
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81426

Show key headers only | View raw


On Mon, Nov 24, 2014 at 3:42 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> Today dis() returns the above, tomorrow it may return:
>
>               0 LOAD_GLOBAL              0 (x)
>               3 INCREMENT
>               5 RETURN_VALUE
>
> (say), and the Python code remains the same even though the byte code is
> different.

I hope not! The x in the original function was a local, not a global,
and if dis.dis() says LOAD_GLOBAL for something that's not global, it
would be *very* confusing! :)

But yes, CPython could grow an INCREMENT bytecode, and it'd not break anything.

ChrisA

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


Thread

Comprehension with two variables - explanation needed "Ivan Evstegneev" <webmailgroups@gmail.com> - 2014-11-23 16:56 +0200
  Re: Comprehension with two variables - explanation needed Rustom Mody <rustompmody@gmail.com> - 2014-11-23 07:09 -0800
    RE: Comprehension with two variables - explanation needed "Ivan Evstegneev" <webmailgroups@gmail.com> - 2014-11-23 17:37 +0200
    Re: Comprehension with two variables - explanation needed Chris Angelico <rosuav@gmail.com> - 2014-11-24 02:42 +1100
    RE: Comprehension with two variables - explanation needed Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-23 09:45 -0600
      Re: Comprehension with two variables - explanation needed Roy Smith <roy@panix.com> - 2014-11-23 10:57 -0500
        Re: Comprehension with two variables - explanation needed Rustom Mody <rustompmody@gmail.com> - 2014-11-23 08:45 -0800
          Re: Comprehension with two variables - explanation needed Rustom Mody <rustompmody@gmail.com> - 2014-11-23 09:17 -0800
          RE: Comprehension with two variables - explanation needed "Ivan Evstegneev" <webmailgroups@gmail.com> - 2014-11-23 19:27 +0200
          Re: Comprehension with two variables - explanation needed Steven D'Aprano <steve@pearwood.info> - 2014-11-24 04:42 +0000
            Re: Comprehension with two variables - explanation needed Chris Angelico <rosuav@gmail.com> - 2014-11-24 15:51 +1100
              Re: Comprehension with two variables - explanation needed Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-25 09:20 +1100
            Re: Comprehension with two variables - explanation needed Rustom Mody <rustompmody@gmail.com> - 2014-11-23 22:47 -0800
            Re: Comprehension with two variables - explanation needed Dan Stromberg <drsalists@gmail.com> - 2014-11-24 16:42 -0800
        Re: Comprehension with two variables - explanation needed Skip Montanaro <skip.montanaro@gmail.com> - 2014-11-23 10:45 -0600
        Re: Comprehension with two variables - explanation needed Roy Smith <roy@panix.com> - 2014-11-23 12:08 -0500
        Re: Comprehension with two variables - explanation needed Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2014-11-23 17:46 +0000

csiph-web