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


Groups > comp.lang.python > #100843

Re: Idiom for this case?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Idiom for this case?
Date Thu, 24 Dec 2015 17:47:08 -0500
Lines 19
Message-ID <mailman.136.1450997406.2237.python-list@python.org> (permalink)
References <86270a67-afff-42a4-a940-9f825fb57146@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de HsXfz6c8ZjtgYN0Ppuj6rgu0ulM5DvNEkHID0VcCOL6g==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'one?': 0.05; "'0',": 0.09; 'combines': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.11; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:case': 0.16; 'wrote:': 0.16; 'config': 0.18; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'print': 0.30; 'there': 0.36; 'lines': 0.36; 'received:71': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'no.': 0.62; "'2',": 0.84; "'3',": 0.84; 'idiom': 0.84; 'subject:this': 0.85; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-71-185-227-36.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
In-Reply-To <86270a67-afff-42a4-a940-9f825fb57146@googlegroups.com>
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:100843

Show key headers only | View raw


On 12/24/2015 5:04 PM, KP wrote:
> Given:
>
> cfg =  {'c': ('3840', '1024'),
>         'p1': {'gpio': '1', 'id': '4', 'coord': ('0', '0', '1280', '1024')},
>         'p2': {'gpio': '2', 'id': '5', 'coord': ('1280', '0', '2560', '1024')},
>         'p3': {'gpio': '3', 'id': '6', 'coord': ('2560', '0', '3840', '1024')}}
>
> for config in cfg:
>      if config != 'canvas':
>          print config
>
> Is there an idiom that combines the 'for...' & the 'if..' lines into one?

No.

-- 
Terry Jan Reedy

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


Thread

Idiom for this case? KP <kai.peters@gmail.com> - 2015-12-24 14:04 -0800
  Re: Idiom for this case? Ben Finney <ben+python@benfinney.id.au> - 2015-12-25 09:30 +1100
  Re: Idiom for this case? Terry Reedy <tjreedy@udel.edu> - 2015-12-24 17:47 -0500

csiph-web