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


Groups > comp.lang.python > #100835

Is there an idiom for this?

Newsgroups comp.lang.python
Date 2015-12-24 14:11 -0800
Message-ID <08289d1a-a032-490f-963f-cc40ec0d81e3@googlegroups.com> (permalink)
Subject Is there an idiom for this?
From KP <kai.peters@gmail.com>

Show all headers | View raw


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 != 'c': 
        print config 

Is there an idiom that combines the 'for...' & the 'if..' lines into one? 

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


Thread

Is there an idiom for this? KP <kai.peters@gmail.com> - 2015-12-24 14:11 -0800
  Re: Is there an idiom for this? Paul Rubin <no.email@nospam.invalid> - 2015-12-24 14:15 -0800
    Re: Is there an idiom for this? KP <kai.peters@gmail.com> - 2015-12-24 14:32 -0800
  Re: Is there an idiom for this? Quivis <quivis@domain.invalid> - 2015-12-28 19:10 +0000

csiph-web