Re: Reversing a List

2010-09-02 Thread Victor Subervi
On Wed, Sep 1, 2010 at 9:26 AM, Shashwat Anand wrote: > > > On Wed, Sep 1, 2010 at 6:45 PM, Matt Saxton wrote: > >> On Wed, 1 Sep 2010 09:00:03 -0400 >> Victor Subervi wrote: >> >> > Hi; >> > I have this code: >> > >> > cursor.execute('describe products;') >> > cols = [item[0] for item in cu

Re: Reversing a List

2010-09-01 Thread Dave Angel
Victor Subervi wrote: Hi; I have this code: cursor.execute('describe products;') cols = [item[0] for item in cursor] cols = cols.reverse() cols.append('Delete') cols = cols.reverse() Unfortunately, the list doesn't reverse. If I print cols after the first reverse(), it prints None. Pl

Re: Reversing a List

2010-09-01 Thread Shashwat Anand
On Wed, Sep 1, 2010 at 6:45 PM, Matt Saxton wrote: > On Wed, 1 Sep 2010 09:00:03 -0400 > Victor Subervi wrote: > > > Hi; > > I have this code: > > > > cursor.execute('describe products;') > > cols = [item[0] for item in cursor] > > cols = cols.reverse() > > cols.append('Delete') > > co

Re: Reversing a List

2010-09-01 Thread Victor Subervi
On Wed, Sep 1, 2010 at 9:17 AM, Shashank Singh < shashank.sunny.si...@gmail.com> wrote: > reverse reverses in-place > > >>> l = [1, 2, 3] > >>> r = l.reverse() > >>> r is None > True > >>> l > [3, 2, 1] > >>> > Ah. Thanks! beno -- http://mail.python.org/mailman/listinfo/python-list

Re: Reversing a List

2010-09-01 Thread Shashank Singh
reverse reverses in-place >>> l = [1, 2, 3] >>> r = l.reverse() >>> r is None True >>> l [3, 2, 1] >>> On Wed, Sep 1, 2010 at 6:30 PM, Victor Subervi wrote: > Hi; > I have this code: > > cursor.execute('describe products;') > cols = [item[0] for item in cursor] > cols = cols.reverse() >

Re: Reversing a List

2010-09-01 Thread Matt Saxton
On Wed, 1 Sep 2010 09:00:03 -0400 Victor Subervi wrote: > Hi; > I have this code: > > cursor.execute('describe products;') > cols = [item[0] for item in cursor] > cols = cols.reverse() > cols.append('Delete') > cols = cols.reverse() > > Unfortunately, the list doesn't reverse. If I pr