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
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
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