Eliminate "extra" variable

Joel Goldstick joel.goldstick at gmail.com
Fri Dec 6 19:32:28 EST 2013


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

> In article <mailman.3672.1386373120.18130.python-list at python.org>,
>  Joel Goldstick <joel.goldstick at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131206/22b58afd/attachment.html>


More information about the Python-list mailing list