Re: Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Michael Spencer
Gregg Lind wrote: > I wish something like this was part of the standard python installation, > and didn't require one to use Numpy or Numarray. This sort of list > subsetting is useful in many, many contexts. > Many of numpy's multi-dimensional slicing and indexing operations are implemented

Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Gregg Lind
I wish something like this was part of the standard python installation, and didn't require one to use Numpy or Numarray. This sort of list subsetting is useful in many, many contexts. -- http://mail.python.org/mailman/listinfo/python-list

Re: Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Fredrik Lundh
Gregg Lind wrote: > One difficulty I am having with using Python for scientific computing is > that I cannot figure out good ways to get arbitrary (unpatterned?) slices. > In Python, solutions I have found for these tasks are: > > [vals[ii] for ii in wanted]# task 1 > > [a[1] for in zip

Slicing / subsetting list in arbitrary fashion

2006-11-17 Thread Gregg Lind
One difficulty I am having with using Python for scientific computing is that I cannot figure out good ways to get arbitrary (unpatterned?) slices. As an example, in R or Matlab / Octave, syntax exists such that: vals = range(6) wanted = [1,2,3,1,1,1] vals[wanted] = [1,2,3,1,1,1] Both of those