Re: Newbie: The philosophy behind list indexes

2013-06-19 Thread ian . l . cameron
Thanks everyone for taking the time to offer some very insightful replies. Learning a new language is so much more fun with a group of friendly and helpful people around! -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: The philosophy behind list indexes

2013-06-15 Thread Olive
On 15/06/13 07:21, ian.l.came...@gmail.com wrote: I bet this is asked quite frequently, however after quite a few hours searching I haven't found an answer. What is the thinking behind stopping 'one short' when slicing or iterating through lists? By example; a=[0,1,2,3,4,5,6] a [0, 1, 2,

Re: Newbie: The philosophy behind list indexes

2013-06-15 Thread John Ladasky
On Friday, June 14, 2013 10:21:28 PM UTC-7, ian.l@gmail.com wrote: >I'm sure there's a good reason, but I'm worried it will result in a lot of >'one-off' errors for me, so I need to get my head around the philosophy of this >behaviour, and where else it is observed (or not observed.) My under

Re: Newbie: The philosophy behind list indexes

2013-06-14 Thread Peter Otten
Chris Rebert wrote: > On Jun 14, 2013 10:26 PM, wrote: >> What is the thinking behind stopping 'one short' when slicing or >> iterating through lists? > I find Dijkstra's explanation rather convincing: > http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html This is the only case whe

Re: Newbie: The philosophy behind list indexes

2013-06-14 Thread Chris Angelico
On Sat, Jun 15, 2013 at 3:21 PM, wrote: > What is the thinking behind stopping 'one short' when slicing or iterating > through lists? > > By example; > a=[0,1,2,3,4,5,6] a > [0, 1, 2, 3, 4, 5, 6] a[2:5] > [2, 3, 4] > > To my mind, it makes more sense to go to 5. I'm sure there's a

Re: Newbie: The philosophy behind list indexes

2013-06-14 Thread Chris Rebert
On Jun 14, 2013 10:26 PM, wrote: > I bet this is asked quite frequently, however after quite a few hours searching I haven't found an answer. > > What is the thinking behind stopping 'one short' when slicing or iterating through lists? > > By example; > > >>> a=[0,1,2,3,4,5,6] > >>> a > [0, 1, 2,

Newbie: The philosophy behind list indexes

2013-06-14 Thread ian . l . cameron
I bet this is asked quite frequently, however after quite a few hours searching I haven't found an answer. What is the thinking behind stopping 'one short' when slicing or iterating through lists? By example; >>> a=[0,1,2,3,4,5,6] >>> a [0, 1, 2, 3, 4, 5, 6] >>> a[2:5] [2, 3, 4] To my mind,