Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #93621
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.030 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'expressions': 0.07; 'cc:addr:python-list': 0.09; 'snippet': 0.09; 'python': 0.10; '42,': 0.16; 'evaluates': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'doc': 0.22; 'referring': 0.22; 'am,': 0.23; "python's": 0.23; 'header:In- Reply-To:1': 0.24; 'points': 0.27; 'fri,': 0.27; 'right.': 0.27; 'message-id:@mail.gmail.com': 0.27; "i'm": 0.30; 'url:python': 0.33; 'received:google.com': 0.35; 'execution': 0.35; 'but': 0.36; 'there': 0.36; 'url:org': 0.36; 'evaluation': 0.36; 'subject:: ': 0.37; 'sure': 0.39; 'whatever': 0.39; 'some': 0.40; 'url:3': 0.60; 'here.': 0.62; 'to,': 0.63; 'grab': 0.64; 'jul': 0.72; 'chrisa': 0.84; 'to:none': 0.91; 'url:reference': 0.91 |
| 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=FFSgcwjHXpSOznsZDUrFugF011jwE8KLt4pkR7krLIc=; b=kdbHFwKp0wOgHkCfUdaIVNrJLayt+O8Nv3O0atVwDpAV+b0KgGq3wu62HZQsCi9mhb PTbtUJWWC3VxR807tP1Sq3dc+zRJhxPQWav+8t1AA9Ywtxi3yh9y0PQps19sMCRwomWJ Zr9c9gI6D2tKHfccEmVq9QkJP4OMqfgKYKmlVRUYe8Va7SnGPmZRThUGongtOMTaKHgW WX9GzsYeBBA6EsrbY7DTc3osfndldnGpqi6ILzyiZpiZHswgbsJNQTX2goqr4xh+ndyj 5nDvhWuQJSQ9iXUE9jEpgMNIY+t6zAjcQ1rtYkIEG3UKs/bJlKadwx39Nf4jG5ZwO3EU 68Lw== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.9.142 with SMTP id 14mr3007975ioj.142.1436493761120; Thu, 09 Jul 2015 19:02:41 -0700 (PDT) |
| In-Reply-To | <436cb6ac-59a4-44f1-be60-cdec1e509296@googlegroups.com> |
| References | <436cb6ac-59a4-44f1-be60-cdec1e509296@googlegroups.com> |
| Date | Fri, 10 Jul 2015 12:02:41 +1000 |
| Subject | Re: Evaluation order |
| 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.20+ |
| 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.379.1436493764.3674.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1436493764 news.xs4all.nl 2852 [2001:888:2000:d::a6]:52870 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:93621 |
Show key headers only | View raw
On Fri, Jul 10, 2015 at 10:10 AM, candide <c.candide@laposte.net> wrote: > The official doc explains that : > > Python evaluates expressions from left to right. > > cf. https://docs.python.org/3.3/reference/expressions.html#evaluation-order > > > But consider the following snippet : > > >>>> t=[2020, 42, 2015] >>>> t*(1+int(bool(t.sort()))) > [42, 2015, 2020] >>>> > > > Is there not some contradiction with left-right evalutation? I'm not sure what contradiction you're referring to, here. The evaluation that you're pointing out says, as Terry showed via the disassembly, that Python's first action is to look up the name 't' and grab a reference to whatever object it points to. The execution of t.sort() has to happen before the multiplication, because of the parentheses. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Evaluation order candide <c.candide@laposte.net> - 2015-07-09 17:10 -0700
Re: Evaluation order Terry Reedy <tjreedy@udel.edu> - 2015-07-09 21:45 -0400
Re: Evaluation order Chris Angelico <rosuav@gmail.com> - 2015-07-10 12:02 +1000
Re: Evaluation order candide <c.candide@laposte.net> - 2015-07-10 05:04 -0700
Re: Evaluation order Ned Batchelder <ned@nedbatchelder.com> - 2015-07-10 05:19 -0700
Re: Evaluation order Terry Reedy <tjreedy@udel.edu> - 2015-07-10 08:27 -0400
Re: Evaluation order Chris Angelico <rosuav@gmail.com> - 2015-07-11 00:27 +1000
Re: Evaluation order Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-07-10 15:49 +0100
csiph-web