Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; ';-)': 0.03; 'result,': 0.07; '"my': 0.09; 'converted': 0.09; 'function:': 0.09; 'lawrence': 0.09; 'slow.': 0.09; 'subject:extra': 0.09; 'suggestions.': 0.09; 'sure,': 0.09; 'missed': 0.12; 'wrote': 0.14; '12:57': 0.16; 'called.': 0.16; 'dog': 0.16; 'guys,': 0.16; 'igor': 0.16; 'looping': 0.16; 'once.': 0.16; 'roy': 0.16; 'sqlite': 0.16; 'subject:variable': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'variable': 0.18; 'input': 0.22; 'string,': 0.24; 'purposes': 0.26; 'query': 0.26; 'this:': 0.26; '----------': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'tim': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'chase': 0.31; 'convenience': 0.31; 'probably': 0.32; 'text': 0.33; 'url:python': 0.33; 'checking': 0.33; 'guess': 0.33; 'date:': 0.34; 'maybe': 0.34; 'skip:d 20': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'dates': 0.36; 'processed': 0.36; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'list': 0.37; 'thank': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'forwarded': 0.39; 'subject:': 0.39; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'called': 0.40; 'url:mail': 0.40; 'engines': 0.60; 'subject:Fwd': 0.61; 'you.': 0.62; 'reach': 0.63; 're:': 0.63; 'valuable': 0.63; 'more': 0.64; 'kept': 0.65; 'worth': 0.66; 'between': 0.67; 'smith': 0.68; 'quality': 0.72; 'article': 0.77; 'reading,': 0.84; '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 :content-type; bh=l3KhxkMa31v17uqq7nCDZulcPz3r1q3zrHCmOoHyh2k=; b=v1otwcopg5tTGR1t6zqI8Ywx+dhU8wSfcH5PMCKtlwZWaARYE1FATq0p29peqpsBvo bSpZrF8gGFIOl84thOL2jLTDRIr6emYlDZpyKP8EARsiAsD/7xGpUnSlNnBIr5lzFk+8 TvGUsQ1gRXDKxImWoXl2khUC94nigZhqjkBKuQIDdiUJvQPpeI5vt6SUOpM+RmorARzi DdCf7Asg50PhZMmAKXpHhEXw50wcYz3CXl7UNpbRgxFF8Cv/GifQ5rE7cp1tBgmHLMNt kCjmUQq2Y08CLqgc78bIfWGDy8KJa662vyIe+hEBYS9F4Feax5LQ5Uk5pOZguLWDQ4jG 5s3Q== MIME-Version: 1.0 X-Received: by 10.53.13.44 with SMTP id ev12mr7713773vdd.17.1386536299062; Sun, 08 Dec 2013 12:58:19 -0800 (PST) In-Reply-To: References: <52A25D94.9040404@islandtraining.com> <20131208125823.241112db@bigbox.christie.dr> Date: Sun, 8 Dec 2013 12:58:18 -0800 Subject: Fwd: Eliminate "extra" variable From: Igor Korot To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-Mailman-Approved-At: Sun, 08 Dec 2013 23:01:28 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386540089 news.xs4all.nl 2941 [2001:888:2000:d::a6]:55000 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61329 ---------- 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 the checking of the data quality is a DB burden. ;-) As to the function: the function purpose is to process the data and give out the list of dates and the dictionary of date:frequency. It's input is the query result, so there is no looping when the function is called. It is called only once. Also, the data comes from either SQLite or mySQL and so to eliminate the difference between those engines dates are processed as strings and converted to dates for the calculation purposes only. Maybe I will need to refactor SQLite processing to get the dates as dates and not a string, but that's probably for the future. so that dates will be kept as the datetime type until the end of the function. As I wrote the dates will be used as the text for the plotting window axis labels and as the labels they should come out as strings, hence the conversion. Thank you. On Sun, Dec 8, 2013 at 12:07 PM, Roy Smith wrote: > In article , > Mark Lawrence wrote: > >> On 08/12/2013 18:58, Tim Chase wrote: >> > On 2013-12-07 23:14, Igor Korot wrote: >> >> [big snip] >> >> > >> >> Whenever I need date manipulations I always reach out to this >> http://labix.org/python-dateutil > > The problem with dateutil is it's dog slow. Sure, I use it too, when > convenience is more important than performance, but have you ever looked > at the code for dateutil.parser.parse()? It's worth reading, just for > fun. > -- > https://mail.python.org/mailman/listinfo/python-list