Re: [Tutor] Mixing generator expressions with list definitions

2007-04-18 Thread Ed Singleton
On 4/18/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > I would like to be able to do something along the lines of: > > > my_list = [1, 2, x for x in range(3,6), 6] > > > > However this doesn't work. Is there any way of achieving this kind of > > thing? > > my_list = [1

Re: [Tutor] Mixing generator expressions with list definitions

2007-04-18 Thread Kent Johnson
Kent Johnson wrote: > my_list.extent(range(3, 6)) should be my_list.extend(range(3, 6)) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Mixing generator expressions with list definitions

2007-04-18 Thread Kent Johnson
Ed Singleton wrote: > I would like to be able to do something along the lines of: > my_list = [1, 2, x for x in range(3,6), 6] > > However this doesn't work. Is there any way of achieving this kind of thing? my_list = [1, 2] + range(3,6) + [6] or, to build it in steps, my_list = [1, 2] my