<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>t+1 - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-fec05512" type="application/json"/><link>http://tplus1.disqus.com/</link><description></description><language>en</language><lastBuildDate>Wed, 01 Jul 2009 21:54:40 -0000</lastBuildDate><item><title>Re: Python&amp;#8217;s hash lookup is insanely good</title><link>http://blog.tplus1.com/index.php/2008/03/17/pythons-hash-lookup-is-insanely-good/#comment-12015160</link><description>And hash tables and programming in general lol</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">CSMajor</dc:creator><pubDate>Wed, 01 Jul 2009 21:54:40 -0000</pubDate></item><item><title>Re: Don&amp;#8217;t negotiate on your estimates</title><link>http://blog.tplus1.com/index.php/2009/06/07/dont-negotiate-on-your-estimates/#comment-11852192</link><description>Eye opening post. We must all break free from the barriers of pessimism and try to think broader and understand other people instead of looking down on them.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">cockcage</dc:creator><pubDate>Sun, 28 Jun 2009 10:16:54 -0000</pubDate></item><item><title>Re: How to write a resume for an internship</title><link>http://blog.tplus1.com/index.php/2009/06/26/how-to-write-a-resume-for-an-internship/#comment-11834036</link><description>Thanks Niels!  I'll do that and see what happens.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">mw44118</dc:creator><pubDate>Sat, 27 Jun 2009 13:40:47 -0000</pubDate></item><item><title>Re: How to write a resume for an internship</title><link>http://blog.tplus1.com/index.php/2009/06/26/how-to-write-a-resume-for-an-internship/#comment-11782996</link><description>Very solid post.  Submit it to digg/reddit etc ...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Niels</dc:creator><pubDate>Fri, 26 Jun 2009 14:00:36 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11722788</link><description>Shouldn't the function name be "price" instead? Why introduce a variable just for  naming when the function name serves that purpose?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Brandon Corfman</dc:creator><pubDate>Thu, 25 Jun 2009 10:03:25 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11722486</link><description>Second one would be great for me! I liked both of these btw!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">freestylemedela</dc:creator><pubDate>Thu, 25 Jun 2009 09:54:34 -0000</pubDate></item><item><title>Re: Define your validation schema inline</title><link>http://blog.tplus1.com/index.php/2008/12/03/define-your-validation-schema-inline/#comment-11719629</link><description>Declarative style is more appropriate and much easy to understand. Thank you for giving us some insights about schema.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">chiro12</dc:creator><pubDate>Thu, 25 Jun 2009 08:07:55 -0000</pubDate></item><item><title>Re: Ditz versus bugs everywhere</title><link>http://blog.tplus1.com/index.php/2008/12/22/ditz-versus-bugs-everywhere/#comment-11719088</link><description>quiet good.. I think the Python docs have more explanatory text in just the table of contents.. :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ging05</dc:creator><pubDate>Thu, 25 Jun 2009 07:33:03 -0000</pubDate></item><item><title>Re: A few examples of how to use :g in vim</title><link>http://blog.tplus1.com/index.php/2007/11/28/a-few-examples-of-how-to-use-g-in-vim/#comment-11536528</link><description>Thanks for posting this one. It really helped me a lot.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">chocolover</dc:creator><pubDate>Sun, 21 Jun 2009 16:37:01 -0000</pubDate></item><item><title>Re: My new ticket tracking system is now vaporware!</title><link>http://blog.tplus1.com/index.php/2009/02/22/my-new-ticket-tracking-system-is-now-vaporware/#comment-11530745</link><description>SVG charts are great for this! Can't wait to see the finished product!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">zoooom</dc:creator><pubDate>Sun, 21 Jun 2009 11:34:15 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11499112</link><description>I agree with the commenters on clp - as a user of the function looking at the signature, I would expect that initial_time needed to be a string.   &lt;br&gt;&lt;br&gt;If you wanted to use something more explicit than None, then you could use a placeholder object, e.g.&lt;br&gt;&lt;br&gt;TODAY = object()&lt;br&gt;def midnight_next_day(initial_time=TODAY):&lt;br&gt;    if initial_time is TODAY:&lt;br&gt;    ...&lt;br&gt;&lt;br&gt;however pylint still complains that instance of object does not have a date method.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dave Kirby</dc:creator><pubDate>Sat, 20 Jun 2009 09:37:38 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11490909</link><description>With multiple return points I find myself spelling out implicit else statement:&lt;br&gt;&lt;br&gt;def(a,b):&lt;br&gt;__if b:&lt;br&gt;____return h(g(a))&lt;br&gt;__else:&lt;br&gt;____return g(a)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Michael</dc:creator><pubDate>Fri, 19 Jun 2009 22:17:14 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11487245</link><description>&amp;gt; The vast majority of pythoners use None, but I prefer descriptive strings for default values&lt;br&gt;&lt;br&gt;If you do that, you're communicating badly.&lt;br&gt;&lt;br&gt;Python's default arguments mean something very specific, and readers will expect it: “this argument can be omitted, and if so, *this value will be used instead*”. By putting a value there that you never intend on using, you subvert that communication.&lt;br&gt;&lt;br&gt;Please, if you don't have a good static value to use, just stick with the conventional sentinel value: None.&lt;br&gt;&lt;br&gt;If you need None for some other purpose (e.g. you need to tell the difference between the default and a user-supplied None), use a clearly-for-no-other-purpose object, such as a module-local name bound to a unique object() instance.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ben Finney</dc:creator><pubDate>Fri, 19 Jun 2009 19:19:24 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11485018</link><description>I'd prefer the first one, easy to read, easy to understand.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">seenxu</dc:creator><pubDate>Fri, 19 Jun 2009 18:08:03 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11482203</link><description>Nicely refactored.&lt;br&gt;"Gordian knot? What gordian knot? Just a bunch of pieces of rope on the floor here." :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">D'gou</dc:creator><pubDate>Fri, 19 Jun 2009 16:45:04 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11479844</link><description>I'd turn it into two functions: midnight_tomorrow() and midnight_after(initial_date). Default arguments tell you that you're probably violating the SRP. (Or maybe they're *always* violations; I haven't thought enough about it yet.) Here's a version with two functions:&lt;br&gt;&lt;br&gt;def midnight_tomorrow():&lt;br&gt;....return midnight_after(datetime.now())&lt;br&gt;&lt;br&gt;def midnight_after(initial_time):&lt;br&gt;....return initial_time.date() + timedelta(days=1)&lt;br&gt;&lt;br&gt;There are no conditionals needed, it's two eloc instead of three, and there's less thinking required by the guy who calls these functions. The caller doesn't need the docstring suggested above by Alex or the descriptive default value you used; the functions' names are fully self-descriptive.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gary Bernhardt</dc:creator><pubDate>Fri, 19 Jun 2009 15:45:16 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11479033</link><description>code does not come out that nice on the comment. Let's try this instead:&lt;br&gt;&lt;br&gt;&lt;a href="http://pastebin.com/m19049702" rel="nofollow"&gt;http://pastebin.com/m19049702&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nes</dc:creator><pubDate>Fri, 19 Jun 2009 15:25:18 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11478834</link><description>pylint thinks initial_time might be a string sometimes.&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; def midnight_next_day(initial_time="use today's date"):&lt;br&gt;&lt;br&gt;     if initial_time == "use today's  date":&lt;br&gt;        initial_time = datetime.now()&lt;br&gt;&lt;br&gt;     return initial_time.date() + timedelta(days=1)&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; midnight_next_day()&lt;br&gt;&lt;br&gt;Traceback (most recent call last):&lt;br&gt;  File "&amp;lt;pyshell#24&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;br&gt;    midnight_next_day()&lt;br&gt;  File "&amp;lt;pyshell#23&amp;gt;", line 6, in midnight_next_day&lt;br&gt;    return initial_time.date() + timedelta(days=1)&lt;br&gt;AttributeError: 'str' object has no attribute 'date'&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">nes</dc:creator><pubDate>Fri, 19 Jun 2009 15:20:42 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11460289</link><description>Sorry, but that's so nasty. Just use None and provide the description as a comment or in the docstring, please. None exists for a reason.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex</dc:creator><pubDate>Fri, 19 Jun 2009 14:16:50 -0000</pubDate></item><item><title>Re: Is this pylint error message valid or bogus?</title><link>http://blog.tplus1.com/index.php/2009/06/19/is-this-pylint-error-message-valid-or-bogus/#comment-11460263</link><description>there is no need for an if statement:&lt;br&gt;&lt;br&gt;initial_time = intial_time or datatime.now()&lt;br&gt;&lt;br&gt;the original version is bad because it suggests that your functions is taking string parameters, where in fact it takes datetime objects. Misleading.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Fri, 19 Jun 2009 14:16:13 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11455580</link><description>I on the other hand love multiple return statements in loops and --while using php-- switches. I actually find that situation a lot using switches.&lt;br&gt;&lt;br&gt;In some switches I don't use break at all since all my cases end with return. Some times however I have to do additional work before getting out of the function, then it's temp variable time again.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">rgz</dc:creator><pubDate>Fri, 19 Jun 2009 13:08:07 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11454997</link><description>For me, it depends on the rest of the code in the function.  Multiple obvious return statements aren't "bad":&lt;br&gt;&lt;br&gt;def f(...):&lt;br&gt;   if param is bad:&lt;br&gt;      return None&lt;br&gt;&lt;br&gt;  ... do stuff ...&lt;br&gt;  return answer&lt;br&gt;&lt;br&gt;but I don't like having returns sprinkled throughout the code, and especially not in loops, where it can complicate the logic of the execution flow.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Titus Brown</dc:creator><pubDate>Fri, 19 Jun 2009 12:54:47 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11441346</link><description>the indentation disappeared. Using _ as space:&lt;br&gt;def(a,b):&lt;br&gt;__if b:&lt;br&gt;____return h(g(a))&lt;br&gt;__return g(a)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">elzapp</dc:creator><pubDate>Fri, 19 Jun 2009 07:04:54 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11441325</link><description>How about&lt;br&gt;def(a,b):&lt;br&gt;    if b:&lt;br&gt;        return h(g(a))&lt;br&gt;    return g(a)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">elzapp</dc:creator><pubDate>Fri, 19 Jun 2009 07:03:52 -0000</pubDate></item><item><title>Re: Which code layout do you like more?</title><link>http://blog.tplus1.com/index.php/2009/06/18/which-code-layout-do-you-like-more/#comment-11441290</link><description>I first learnt to program in the early 1990s using books, and thus methodologies, that were already old and discarded by their previous owners. All I really remember was the love of flowcharts and subtle re-enforcement of the idea that multiple return statements made code so hard to read that anyone else who saw it would meet an untimely end.&lt;br&gt;&lt;br&gt;I think modern teaching styles have moved towards a more understanding based approach that credits the student with a little intelligence. Consider the following fragments of introductory programming:&lt;br&gt;&lt;br&gt;* All functions must return a value&lt;br&gt;* No code after a return is executed&lt;br&gt;* a function can only return one value&lt;br&gt;&lt;br&gt;Nice nuggets of information that can be memorised by rote. So very early on one gets into the habit of putting the return at the end of a function because it has to be there and thinking nothing more of it. It took a long time for me to unlearn that habit.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Charles</dc:creator><pubDate>Fri, 19 Jun 2009 07:01:23 -0000</pubDate></item></channel></rss>