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


Groups > comp.lang.python > #43636

Re: Process tuple contents on the fly

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <musikal.fusion@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'read.': 0.03; 'cc:addr :python-list': 0.11; 'd[key]': 0.16; 'dict': 0.16; 'to:addr:python.list': 0.16; 'to:addr:tim.thechases.com': 0.16; 'to:name:tim chase': 0.16; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**1': 0.23; 'skip:\xa0 20': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'easier': 0.31; 'subject:the': 0.34; 'received:google.com': 0.35; '8bit%:4': 0.38; 'more': 0.64; 'results': 0.69; 'received:mail- ob0-x22f.google.com': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=vw/AC8Qg+fOiY6uwA7wXKdt1d+zrJIu0zocAgqB1htw=; b=DDw4fvmIJ71cP2EsxJiDVFNR1Iq0o3dOsWv8S8Gc2ucEf4OVwtMagWztGatJ7NoB9m FFo5XyFS5Rgsb2ZPrz6lMMiEw7e+7G1rxFuwLHMcgyoM3Khb6pdI6/iAqcuT6ERLD3n3 fa9p401qAfCjTUFMXhC8Hp4Fzrsgb27xvnjOGNrZag3PQGXe/xpquP7156bqrVVj8b84 a03Ic+T5ZsnKiR2/8Fw3QBVhPDLCkZ/9dgPFapPn1/d0PFlz/jTIE6SI3v/v/3ahVlb4 f6lsq3LbP/SG+nFJiU6oxSvzeKMWB+NKuhX1QV48fVZAxCMmZkvowySVZkCX6c6Q54Ow brJA==
X-Received by 10.182.164.8 with SMTP id ym8mr7957575obb.68.1366052734328; Mon, 15 Apr 2013 12:05:34 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <20130415135013.58430065@bigbox.christie.dr>
References <f51058c3-0e36-429c-85d9-365be82b548f@googlegroups.com> <20130415135013.58430065@bigbox.christie.dr>
From Barrett Lewis <musikal.fusion@gmail.com>
Date Mon, 15 Apr 2013 12:05:04 -0700
Subject Re: Process tuple contents on the fly
To Tim Chase <python.list@tim.thechases.com>
Content-Type multipart/alternative; boundary=e89a8f646a07f9b74404da6aefd6
Cc Python Mailing List <python-list@python.org>, Gnarlodious <gnarlodious@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.641.1366052737.3114.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366052737 news.xs4all.nl 2650 [2001:888:2000:d::a6]:52364
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43636

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

>   d = {}
>   for key, d[key] in (("this",18), ("that",17), ("other",38)):
>     print key
>     do_something(d)
>

Why not use a dict comprehension?
d = {k:v for k,v in  (("this",18), ("that",17), ("other",38))}

I feel this is more straightforward and easier to read. the results are the
same however.

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


Thread

Process tuple contents on the fly Gnarlodious <gnarlodious@gmail.com> - 2013-04-15 11:25 -0700
  Re: Process tuple contents on the fly Tim Chase <python.list@tim.thechases.com> - 2013-04-15 13:50 -0500
  Re: Process tuple contents on the fly Barrett Lewis <musikal.fusion@gmail.com> - 2013-04-15 12:05 -0700
  Re: Process tuple contents on the fly Peter Otten <__peter__@web.de> - 2013-04-15 21:07 +0200
  Re: Process tuple contents on the fly Tim Chase <python.list@tim.thechases.com> - 2013-04-15 14:10 -0500
  Re: Process tuple contents on the fly Barrett Lewis <musikal.fusion@gmail.com> - 2013-04-15 12:16 -0700
  Re: Process tuple contents on the fly MRAB <python@mrabarnett.plus.com> - 2013-04-15 20:29 +0100
  Re: Process tuple contents on the fly Tobiah <toby@tobiah.org> - 2013-04-15 13:35 -0700
    Re: Process tuple contents on the fly Michael Torrie <torriem@gmail.com> - 2013-04-15 15:16 -0600
    Re: Process tuple contents on the fly Gnarlodious <gnarlodious@gmail.com> - 2013-04-15 16:46 -0700

csiph-web