[Zope] Best Zope way to split a textfield on 2000 char increments

Bill Anderson bill@noreboots.com
Fri, 15 Dec 2000 21:10:24 -0700


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