tag:blogger.com,1999:blog-8699431508730375743.post8737672053383472671..comments2015-07-31T04:57:54.422-07:00Comments on The History of Python: Why Python uses 0-based indexingGuido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-8699431508730375743.post-41429081931603717462015-06-23T00:12:13.691-07:002015-06-23T00:12:13.691-07:00Time has the notation of 1:?? in the second hour o...Time has the notation of 1:?? in the second hour of the day. What&#39;s your issue with the years again? Harald Hoyerhttp://www.blogger.com/profile/11533512875002547507noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-57028302766911523612013-10-27T11:34:28.516-07:002013-10-27T11:34:28.516-07:00Over on python-ideas we&#39;re discussing negative...Over on python-ideas we&#39;re discussing negative strides now. The best way to use them is to also use negative indexes. E.g. a[::-1] == a[-1:-1-len(a):-1].Guido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-1710778780105666982013-10-27T03:50:32.381-07:002013-10-27T03:50:32.381-07:00That Cilk thing goes against the entire STL by not...That Cilk thing goes against the entire STL by not using .start() .end() half-closed intervals. What were these guys thinking, or were they even thinking at all.zzbhttp://openid.aliz.es/zzbnoreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-82404579778871798742013-10-26T12:24:54.971-07:002013-10-26T12:24:54.971-07:00You seriously think it makes more sense to have a ...You seriously think it makes more sense to have a year 0? If the FIRST year isn&#39;t year 1, then you end up with the SECOND year being year 1. Yeah, that makes sense. NOT.Phaedrushttp://www.blogger.com/profile/12493104900973331346noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-47173827090908485842013-10-26T10:53:59.042-07:002013-10-26T10:53:59.042-07:00You&#39;ve seen my code on CheckIO. More often tha...You&#39;ve seen my code on CheckIO. More often than you think. :-P<br /><br />But seriously... not only strings, any indexable iterables have same problem. And you haven&#39;t seem to have problems with breaking code (especially without any confirmed examples) before. At least in Py4K? :-)Vekyhttp://www.blogger.com/profile/12207072339468136950noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-3912709165579433622013-10-25T08:53:14.876-07:002013-10-25T08:53:14.876-07:00I agree that slices with negative strides are conf...I agree that slices with negative strides are confusing. We can&#39;t change them (it would break too much code) but you can usually avoid them by using the reversed() function instead, e.g. &#39;&#39;.join(reversed(&quot;abcdefghijklmnop&quot;[3:])). Still not ideal, but how often do you need a string backwards (apart from palindrome puzzles :-)?Guido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-83588773143302192752013-10-25T02:28:05.556-07:002013-10-25T02:28:05.556-07:00Except the indices as boundaries analogy is broken...Except the indices as boundaries analogy is broken. :-(<br /><br />&quot;abcdefghijklmnop&quot;[:3:-1]<br /><br />Note that it ends in e, not in d as it should if you consider 3 as a boundary.<br /><br />When I first encountered this, I thought it was a bug. Boundaries metaphor was something I deeply embraced.<br /><br />Maybe it could stay that way? Guido, can slice semantics with negative stride be changed?Vekyhttp://www.blogger.com/profile/12207072339468136950noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-71300797495576905482013-10-25T01:53:36.667-07:002013-10-25T01:53:36.667-07:00Your mention of graphics coordinates reminds of an...Your mention of graphics coordinates reminds of another index holy war about the location of the origin: top-left or bottom-left?<br /><br />I like ot&#39;s description of indices as boundaries rather than labels. I think it gives both the 0th and 1st camps something to hang their hats on :).MLWhttp://www.blogger.com/profile/11501483710006076616noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-38238546012614377322013-10-24T17:17:10.313-07:002013-10-24T17:17:10.313-07:00If you count objects 0, 1, 2 you wind up with a va...If you count objects 0, 1, 2 you wind up with a value that&#39;s smaller than the number of objects. 0-based indexing works because it is <i>not</i> ordinal.John Cowanhttp://www.blogger.com/profile/11452247999156925669noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-75096460930117342782013-10-24T10:37:39.427-07:002013-10-24T10:37:39.427-07:00Y combinator&#39;s thread on this topic mention th...Y combinator&#39;s thread on this topic mention that in 1985 Inside Macintosh explained why graphics coordinates are 0-based: https://news.ycombinator.com/item?id=6601515 (search for &quot;Macintosh&quot;).Guido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-1997638357662432942013-10-24T10:36:56.259-07:002013-10-24T10:36:56.259-07:00As I pointed out in my G+ post, Dijkstra did not c...As I pointed out in my G+ post, Dijkstra did not consider start:size as an option. Sadly, that&#39;s the way C++ seems to be going (https://www.cilkplus.org/tutorial-array-notation). Guido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-34272854180929167512013-10-24T10:24:20.616-07:002013-10-24T10:24:20.616-07:00Dijkstra had a monograph about this: https://www.c...Dijkstra had a monograph about this: https://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html<br /><br />Also I should point out that the correct first number is zero, and kids should be taught to count &quot;0, 1, 2, ...&quot;. It fixes a lot of problems that you get if you start a 1. In this light, there&#39;s no argument at all for starting indexing at 1.Lawrence Kesteloothttp://www.blogger.com/profile/08175600004629340681noreply@blogger.comtag:blogger.com,1999:blog-8699431508730375743.post-42774959346138078152013-10-24T08:49:58.907-07:002013-10-24T08:49:58.907-07:00To anyone who prefers 1-based indexing: you are th...To anyone who prefers 1-based indexing: you are the same people who screwed up the calendar, starting at year 1 and calling the 1900s the 20th century (and arguing that the year 2001 ought to be the start of the next millennium). Haven&#39;t you done enough damage? :-)Guido van Rossumhttp://www.blogger.com/profile/12821714508588242516noreply@blogger.com