[Tutor] Re: a list comp
Alan Gauld
alan.gauld at blueyonder.co.uk
Thu Dec 11 11:57:05 EST 2003
> > >>> [index for index in del_list if index not in keep_list]
> > [2, 4, 8]
>
> so I still would have expected it to be returned. You said it
yourself
> quote:
>
> > Using the fact, that the list comprehension
> > itself constructs a new list, it goes simply like this:
>
> i.e were not asking newlist.append to return our newlist, were
asking the [result of the list comp]
> to be returned, which we both agree is our newlist :)
And a list will be returned. But it is a list full of 'None's,
one for each append operation.
Alan G.
More information about the Tutor
mailing list