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


Groups > comp.lang.python > #61203

Re: Eliminate "extra" variable

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joel.goldstick@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'happen,': 0.09; 'iterate': 0.09; 'subject:extra': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'docstring': 0.16; 'output?': 0.16; 'roy': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'input': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'lets': 0.24; '---': 0.24; 'cc:2**0': 0.24; 'source': 0.25; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'dec': 0.30; 'skip:& 60': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'directly,': 0.31; 'supposed': 0.32; 'url:python': 0.33; 'fri,': 0.33; 'could': 0.34; 'agree': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'list': 0.37; 'pm,': 0.38; 'explain': 0.39; 'subject:" ': 0.39; 'sure': 0.39; 'url:mail': 0.40; 'even': 0.60; 'complete': 0.62; 'more': 0.64; 'smith': 0.68; 'article': 0.77; 'joel': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WhM3EtuFToYfR8F+mXhjovMTRRN5NrBRHDKZZMIoz9Q=; b=be2UyeC0jOlITMCfWNS9qEpH9zufBfB5rLN5jhj9nZXZuTEoYcNFsojbfkJ3Z5kZ48 ov5BHEKJPZCd6Aq+mx/VJuEO90DT2Pgj5h7cax0w9+d7j1rCQHVbmydbUN0YHsIwGuhu mvThluaC4UGKQPYNN6EzFx93diAymhGrW9XvbQbWlNEv/eI4XS1I1ZgmGwz3uFLHt2/R Gz9ErDbvv58oMw4+nkZlPYIRGYO3Um2ucK9Z6euLtJ87L4GFKXSJnWwSsI+WqdJEkAwC 8vbF0Cf3dql/tT46k+NEBSiAJO2OYlEv+qMJYRrwS6nVPwTL6YfFG0IW3t10bdevwGxC V6xQ==
MIME-Version 1.0
X-Received by 10.220.122.129 with SMTP id l1mr2736279vcr.48.1386376348500; Fri, 06 Dec 2013 16:32:28 -0800 (PST)
In-Reply-To <roy-D13A60.19161306122013@news.panix.com>
References <CA+FnnTzDjRzU65+VWnOwxfVR9FGMDgHLLmLEDOoGE0BMCptzEw@mail.gmail.com> <mailman.3672.1386373120.18130.python-list@python.org> <roy-D13A60.19161306122013@news.panix.com>
Date Fri, 6 Dec 2013 19:32:28 -0500
Subject Re: Eliminate "extra" variable
From Joel Goldstick <joel.goldstick@gmail.com>
To Roy Smith <roy@panix.com>
Content-Type multipart/alternative; boundary=089e013a15f2c7341804ece6e57f
Cc "python-list@python.org" <python-list@python.org>
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 <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>
Newsgroups comp.lang.python
Message-ID <mailman.3680.1386376351.18130.python-list@python.org> (permalink)
Lines 80
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386376351 news.xs4all.nl 2922 [2001:888:2000:d::a6]:59416
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61203

Show key headers only | View raw


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

On Fri, Dec 6, 2013 at 7:16 PM, Roy Smith <roy@panix.com> wrote:

> In article <mailman.3672.1386373120.18130.python-list@python.org>,
>  Joel Goldstick <joel.goldstick@gmail.com> wrote:
>
> > Python lets you iterate over a list directly, so :
> >
> >     for d in originalData:
> >         dateStr, freq, source = d
> >         data[source] = freq
>
> I would make it even simpler:
>
> >     for dateStr, freq, source in originalData:
> >         data[source] = freq
>


+1 --- I agree

To the OP:

Could you add a docstring to your function to explain what is supposed to
happen, describe the input and output?  If you do that I'm sure you could
get some more complete help with your code.

> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

Re: Eliminate "extra" variable Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-06 18:38 -0500
  Re: Eliminate "extra" variable Roy Smith <roy@panix.com> - 2013-12-06 19:16 -0500
    Re: Eliminate "extra" variable Joel Goldstick <joel.goldstick@gmail.com> - 2013-12-06 19:32 -0500

csiph-web