<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>t+1 - Latest Comments in Rewrite my ugly code</title><link>http://tplus1.disqus.com/</link><description></description><atom:link href="http://tplus1.disqus.com/rewrite_my_ugly_code_55/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 03 Feb 2009 01:15:14 -0000</lastBuildDate><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-5802988</link><description>&lt;p&gt;Man I'd help you out but it looks way too complicated for me. I am a php newb still learning from guys like you. Keep up the good work.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Password Recovery</dc:creator><pubDate>Tue, 03 Feb 2009 01:15:14 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4235222</link><description>&lt;p&gt;The highlights are:&lt;br&gt; * parsing&lt;br&gt; * timezones&lt;br&gt; * recurrence&lt;br&gt; * relative deltas&lt;/p&gt;

&lt;p&gt;The docs are quite good, so definitely worth your time to take a peek at.  There's also my &lt;a href="http://www.pirnat.com/static/dateutil.pdf" rel="nofollow"&gt;presentation from PyCon 2007&lt;/a&gt; if you want the quick tour with some examples (beware Gilbert &amp;amp; Sullivan spoilers).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike Pirnat</dc:creator><pubDate>Sun, 07 Dec 2008 09:37:06 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4230003</link><description>&lt;p&gt;I like that quote!  And thanks, this was a fun exercise.  I've been sick for a couple of days, so I haven't had my own ugly code to stare at for a while.  :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Sat, 06 Dec 2008 20:58:57 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229967</link><description>&lt;p&gt;That calendar.monthrange trick is nice.  Allows me to forget about nonsense like leap year and special logic for December.&lt;/p&gt;

&lt;p&gt;I read somewhere that every big python app ends up building a crappier version of what's already in the standard library.  I'm happy to see I've reached that point :)&lt;/p&gt;

&lt;p&gt;Thanks for the help!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Sat, 06 Dec 2008 20:54:24 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229872</link><description>&lt;p&gt;Here's my stab at it: &lt;a href="http://blog.doughellmann.com/2008/12/rewriting-matt-wilson-ugly-code.html" rel="nofollow"&gt;http://blog.doughellmann.com/2...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Sat, 06 Dec 2008 20:43:44 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229642</link><description>&lt;p&gt;Actually now that I look at the rest of your code, I think dateutil has the strong possibility of making you very happy indeed.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike Pirnat</dc:creator><pubDate>Sat, 06 Dec 2008 20:11:03 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229633</link><description>&lt;p&gt;The standard library module "calendar" contains the function monthrange(), which will give you the numerical day of the first and last days of the month.  The last day of the month in get_first_and_last_dom() becomes last_day = datetime.date(dt.year, dt.month, calendar.monthrange(dt.year,dt.month)[1])&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Sat, 06 Dec 2008 20:10:12 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229875</link><description>&lt;p&gt;Thanks Mike -- besides helping with parsing, what else can dateutil&lt;br&gt;help with?  I remember you showed a bunch of neat recurrence trickery&lt;br&gt;as well.  I think I should read all the docs.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Sat, 06 Dec 2008 19:44:10 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229861</link><description>&lt;p&gt;Thanks Doug!  I'm going to read up on the calendar module now.  I bet&lt;br&gt;there is a lot of code I can streamline now.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Sat, 06 Dec 2008 19:42:09 -0000</pubDate></item><item><title>Re: Rewrite my ugly code</title><link>http://blog.tplus1.com/index.php/2008/12/06/rewrite-my-ugly-code/#comment-4229347</link><description>&lt;p&gt;It's not for the function you're wanting help with, but &lt;a href="http://labix.org/python-dateutil" rel="nofollow"&gt;dateutil&lt;/a&gt; would make much shorter work of your date parsing issues.&lt;/p&gt;

&lt;p&gt;My typical usage for parsing date strings is (in a nutshell):&lt;/p&gt;

&lt;p&gt;from dateutil.parser import parse as parse_date&lt;br&gt;dt = parse_date(some_date_string)&lt;/p&gt;

&lt;p&gt;You can add your own formats to it if you need to do crazy stuff.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike Pirnat</dc:creator><pubDate>Sat, 06 Dec 2008 19:37:25 -0000</pubDate></item></channel></rss>
