Re: Quick sort implementation in python

2008-09-26 Thread Alex Snast
On Sep 25, 11:47 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Now as you can see I'm passing my list object to both functions along > > with their first, last indices > > I cannot really see that. More specifically, it isn't definite what the > type of the "a" argument is, nor does the spec

Quick sort implementation in python

2008-09-25 Thread Alex Snast
Hi guys, I've been learning python in the past week and tried to implement a q.sort algorithm in python as follows: def quick_sort(l, first, last) if first < last: q = partition(a, first, last) quick_sort(a, first, q - 1) quick_sort(a, q + 1, last) def partition(a, fir

Re: How to make a reverse for loop in python?

2008-09-21 Thread Alex Snast
On Sep 21, 3:47 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 20 Sep 2008 16:27:41 -0700, Alex Snast wrote: > > Another quick question please, is the List data structure just a dynamic > > array? If so how can you use static size arr

Re: How to make a reverse for loop in python?

2008-09-20 Thread Alex Snast
On Sep 20, 8:13 pm, [EMAIL PROTECTED] wrote: > Duncan Booth: > > > > e.g. the python equivalent to the c++ loop > > > for (i = 10; i >= 0; --i) > > > The exact equivalent would be: > >         for i in range(10, -1, -1): print i > > I'd use xrange there. Anyway, I have always felt that Python synta

Re: How to make a reverse for loop in python?

2008-09-20 Thread Alex Snast
On Sep 20, 8:13 pm, [EMAIL PROTECTED] wrote: > Duncan Booth: > > > > e.g. the python equivalent to the c++ loop > > > for (i = 10; i >= 0; --i) > > > The exact equivalent would be: > >         for i in range(10, -1, -1): print i > > I'd use xrange there. Anyway, I have always felt that Python synta

How to make a reverse for loop in python?

2008-09-20 Thread Alex Snast
Hello I'm new to python and i can't figure out how to write a reverse for loop in python e.g. the python equivalent to the c++ loop for (i = 10; i >= 0; --i) -- http://mail.python.org/mailman/listinfo/python-list