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


Groups > comp.lang.python > #61203

Re: Eliminate "extra" variable

References <CA+FnnTzDjRzU65+VWnOwxfVR9FGMDgHLLmLEDOoGE0BMCptzEw@mail.gmail.com> <mailman.3672.1386373120.18130.python-list@python.org> <roy-D13A60.19161306122013@news.panix.com>
Date 2013-12-06 19:32 -0500
Subject Re: Eliminate "extra" variable
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3680.1386376351.18130.python-list@python.org> (permalink)

Show all headers | 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