Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99292
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | George Trojan <george.trojan@noaa.gov> |
| Newsgroups | comp.lang.python |
| Subject | tuples in conditional assignment |
| Date | Tue, 24 Nov 2015 03:25:48 +0000 |
| Lines | 13 |
| Message-ID | <mailman.83.1448335555.2291.python-list@python.org> (permalink) |
| References | <mailman.36.1447434002.19880.python-list@python.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de lHnBjkhYHunwzkIOQlefPAwmZrSv2r+iiyG+AR8zwRWg== |
| Return-Path | <george.trojan@noaa.gov> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.095 |
| X-Spam-Evidence | '*H*': 0.82; '*S*': 0.01; '(0,': 0.09; 'tuple.': 0.09; 'comma': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; '>>>': 0.20; 'assuming': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'code': 0.30; 'received:google.com': 0.35; 'should': 0.36; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'received:66': 0.38; 'received:209': 0.38; 'received:localdomain': 0.38; 'received:209.85.220': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'charset:windows-1252': 0.62; 'bitten': 0.84; 'case?': 0.84; 'recently:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=noaa-gov.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=WOFgi7COCuGVjaK/5MgC9BCODoBdb/ufsEuakJpI1Nk=; b=eSXNyUnflYhtFVWsDzbvkccbii6cPyYW7AqAROMauC11fh64afJdmFOoU2bq4fh4WG vRbnnhPaOwRnGl05/BZCxgO3JRT0scgYbu0/MqEG06YZLMQjxyiU1z/dldScS5j7nMUN acUqgoUsgjsr16FIN5cEKnb1me1HfydR2/j3fZ6TXAjpP/2kUD3WATXKfkXDMgfJkbZp 25+DaeXYDO7NIa7Tw4wQ9WSfzfQHfgljvsVNTUGqQA6L9PiuATHahJQlOB8z4rhJWf2w fnJjd+OCw6TcS0JLszxSpsecMqhC96+L6lUqyC5ZQgBgPshduFHN+IGwhduEMTgsSQXY iHqg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=WOFgi7COCuGVjaK/5MgC9BCODoBdb/ufsEuakJpI1Nk=; b=dyE257GQP4abA36VCKLS8PdoJtaWgTSM6P+CELuj5dBRd3aJ+z9HE1tBOVYREIGht8 M3u6T3Q+Ux3z3hBNJqbT0Am3BCq+2ApmkuqZNfo8jtsv/vI/EHhhZ4+76y1myfEehHfS mYLi5t9xIJqdOxQFwYKI4SD0q7qu6uJ3qYDmiQ+QnR85EErQwJdS8xczmbbedkr959S2 eIUVMkVAoeMkPZPoifCipsspHWYMh9yTQXRLBwP6CA0IJ2cPBp5LVcpHCSo8yBQHvK4B 0BPWMgroKOLin52Qtwa3C/urfHf5Ym/SqVDxRic9EQV33RnNoRRirFvJ69PxfEXEoaRx NA4A== |
| X-Gm-Message-State | ALoCoQkKUdG/SDJfkDuYrLnMWMfDxLcrzCco+O/sLmP05sQuqXbWXPVfjrPHrBKl+qbWk2uo6ulb |
| X-Received | by 10.68.108.66 with SMTP id hi2mr39963784pbb.131.1448335552443; Mon, 23 Nov 2015 19:25:52 -0800 (PST) |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| In-Reply-To | <mailman.36.1447434002.19880.python-list@python.org> |
| 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> |
| Xref | csiph.com comp.lang.python:99292 |
Show key headers only | View raw
The following code has bitten me recently: >>> t=(0,1) >>> x,y=t if t else 8, 9 >>> print(x, y) (0, 1) 9 I was assuming that a comma has the highest order of evaluation, that is the expression 8, 9 should make a tuple. Why this is not the case? George
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
tuples in conditional assignment George Trojan <george.trojan@noaa.gov> - 2015-11-24 03:25 +0000 Re: tuples in conditional assignment Steven D'Aprano <steve@pearwood.info> - 2015-11-24 22:25 +1100
csiph-web