A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20060711/6cb60fa7/attachment.html below:

<br><br><div><span class="gmail_quote">On 7/11/06, <b class="gmail_sendername"><a href="mailto:skip@pobox.com">skip@pobox.com</a></b> &lt;<a href="mailto:skip@pobox.com">skip@pobox.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&nbsp;&nbsp;&nbsp;&nbsp;Michael&gt; Well here's one I stumbled across the other day. I don't know<br>&nbsp;&nbsp;&nbsp;&nbsp;Michael&gt; if it's legit, but it's still bad PR:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Michael&gt; <a href="http://www.gbch.net/gjb/blog/software/discuss/python-sucks.html">
http://www.gbch.net/gjb/blog/software/discuss/python-sucks.html</a><br><br>&nbsp;&nbsp;&nbsp;&nbsp;Michael&gt; For the impatient, he's not at all bothered about the lack of<br>&nbsp;&nbsp;&nbsp;&nbsp;Michael&gt; obscure language feature X.</blockquote><div><br>
That whole entry is a little overblown.&nbsp; I mean the guy has a single issue with a change and he gives up on the language after only the second one?&nbsp; Try using any language that is under active development and show me stuff that won't break.&nbsp; I think it shows how hard we work to not break things that this guy only got bit twice, and at least the second time was minor and had a legit reason for the change.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The way I used to format dates using time.strftime does indeed no longer<br>work.
<br><br>Python 2.3:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt; import time<br>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt; time.strftime(&quot;%Y-%m-%d&quot;, (2005, 6, 4) + (0,)*6)<br>&nbsp;&nbsp;&nbsp;&nbsp;'2005-06-04'<br><br>Python 2.4 or 2.5:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt; import time<br>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt; 
time.strftime(&quot;%Y-%m-%d&quot;, (2005, 6, 4) + (0,)*6)<br>&nbsp;&nbsp;&nbsp;&nbsp;Traceback (most recent call last):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File &quot;&lt;stdin&gt;&quot;, line 1, in ?<br>&nbsp;&nbsp;&nbsp;&nbsp;ValueError: day of year out of range<br>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt; time.strftime
(&quot;%Y-%m-%d&quot;, (2005, 6, 4) + (1,)*6)<br>&nbsp;&nbsp;&nbsp;&nbsp;'2005-06-04'</blockquote><div><br>That was done to fix buffer overflow issues when libc implementations didn't do bound checks on the arguments to strftime() and would index too far (
e.g., setting the month as 20 indexes too far and setting to 0 can be an issue as well since the array indexing for the month name will be January, and thus will most likely do ``mon - 1`` to get the index into the array). 
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I don't actually run into this problem as I've pretty much converted to use<br>
datetime in new code.&nbsp;&nbsp;I also realize that's not documented as the way it<br>should be done,</blockquote><div><br>It is the last point in the first paragraph on time.strftime() discussing what changed in Python 2.4 as to what the change was.&nbsp; It's also in Misc/NEWS .&nbsp; Basically the guy didn't read the release notes or the docs to see why that changed and that it was legitimate and needed for stability.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> but I'm fairly certain it was common usage before the<br>datetime module came along.&nbsp;&nbsp;Still, it is a bit annoying that the
<br>(undocumented, but I think de facto) commonly used idiom no longer works.</blockquote><div><br>As I said, stability called for the need to make the change.&nbsp; It was discussed on python-dev when it came up.<br></div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">(In fact, it always bothered me a bit that I had to even provide the unused<br>values.)</blockquote>
<div><br>That would probably be fine to add in 2.6 .&nbsp; Should be a huge issue.&nbsp; You could also change the function to detect values of 0 when provided and then automatically use defaults in those cases that are within the proper range.
<br></div><br>-Brett</div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4