Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100843
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Idiom for this case? |
| Date | 2015-12-24 17:47 -0500 |
| Message-ID | <mailman.136.1450997406.2237.python-list@python.org> (permalink) |
| References | <86270a67-afff-42a4-a940-9f825fb57146@googlegroups.com> |
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 | Next — Previous in thread | Find similar | Unroll 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