Re: Fwd: Eliminate "extra" variable

2013-12-08 Thread Dave Angel
On Sun, 8 Dec 2013 12:58:18 -0800, Igor Korot wrote: It's input is the query result, so there is no looping when the function is called. It is called only once. Then why save part of the result in an instance attribute? Just return all of the results as a tuple. -- DaveA -- https://mail.py

Fwd: Eliminate "extra" variable

2013-12-08 Thread Igor Korot
-- Forwarded message -- From: Igor Korot Date: Sun, Dec 8, 2013 at 12:57 PM Subject: Re: Eliminate "extra" variable To: Roy Smith Hi, guys, Thank you for all those valuable suggestions. 2Tim Chase: I guess you missed this: "My originalData comes from the database query" and so t

Fwd: Eliminate "extra" variable

2013-12-08 Thread Igor Korot
OK, here is the complete function code that I'm trying to improve. def MyFunc(self, originalData): self.dates = [] data = {} dateStrs = [] for i in xrange(0, len(originalData)): dateStr, freq, source = originalData[i] data[str(dateStr)] = {source: fr