Bill Anderson wrote:
> 
> Jerome Alet wrote:
> >
> > On Fri, 15 Dec 2000, Steve Drees wrote:
> >
> > > somestring[:1999] is the first 2000 characters of somestring.
> >
> > Not to be a poseur but:
> 
> me either ;^)=
> 
> 
> > somestring[:1999] is the first 1999 characters of somestring, because
> > in Python indices begin at 0, e.g.:
> 
> Actually, it is because the number 1999 refers to the the spot
> *inbetween* 1998 and 1999. Basically, in a list of '0,1,2,3', [0] is 

Oops...

I meant to write: ...before the first...

>the
> first 'comma', and [1] the second, and so on. Counting that way shows
> that you never include the 1999 (or the three in your example. It isn't
> that indices start at zero, it is due to the counting being done on the
> seperator, not the item in the list.


Bill


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to