Re: [Tutor] slice lists and slicing syntax questions

2007-10-13 Thread Dave Kuhlman
On Sat, Oct 13, 2007 at 10:32:39AM -0400, Michael Langford wrote: > On 10/12/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > > > I have been using Python for years now, in all kinds of environments, but > > example: x is vector of length 5, with value "a","b","c","d","e" , then: > > > > x[3,

Re: [Tutor] slice lists and slicing syntax questions

2007-10-13 Thread Kent Johnson
Michael Langford wrote: > When you call [] on an object, it calls __getitem__The definition for > getitem is __getitem__(self,key), where key can be an integer or a slice > object. Or a tuple of integers/slices. > You may want to try to write a PEP for python 3000. So much is being > changed

Re: [Tutor] slice lists and slicing syntax questions

2007-10-13 Thread Michael Langford
On 10/12/07, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > I have been using Python for years now, in all kinds of environments, but > example: x is vector of length 5, with value "a","b","c","d","e" , then: > > x[3,1,1,1,3,2] # gives [d, b, b, b, d, c] > > What is the python equivalent? a.

Re: [Tutor] slice lists and slicing syntax questions

2007-10-12 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > in matrix oriented languages like R, Octave / Matlab, and NumPy, > vectors, > lists, and matrices support slice lists of arbitrary indices. Python is a general purpose language and not matrix oriented. In fact it doesn't have native support for a matrix as such only t

[Tutor] slice lists and slicing syntax questions

2007-10-12 Thread gregg
Hello Python Tutor! I have been using Python for years now, in all kinds of environments, but I don't really understand the restrictions on slicing. As described in http://jtauber.com/blog/2005/08/16/python_slice_questions/ and http://mail.python.org/pipermail/python-list/2006-February/368291.ht