On Wednesday 20 April 2005 01:36 am, Raymond Hettinger wrote: > <[EMAIL PROTECTED]> > > Many people I know ask why Python does slicing the way it does..... [...] > Python's way has some useful properties: [...] > OTOH, it has some aspects that bite: [...] > I suspect that whether it feels natural depends on your previous background > and > whether you're working in an environment with arrays indexed from one or from > zero. For instance, C programmers are used to seeing code like: for(i=0 ; > i<n; i++) a[i]=f(i); In contrast, a BASIC programmer may be used to FOR I = > 1 > to N: a[I]=f(I); NEXT. Hence, the C coders may find Python's a[:n] to be > more natural than BASIC programmers.
Well, I learned Basic, Fortran, C, Python --- more or less. And I first found Python's syntax confusing as it didn't follow the same rules as any of the previous ones. However, I used to make "off by one" errors all the time in both C and Fortran, whereas I hardly ever make them in Python. So I like Python's slicing because it "bites *less*" than intervals in C or Fortran. Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com -- http://mail.python.org/mailman/listinfo/python-list