Anagram

Alex Martelli aleax at aleax.it
Thu Jan 24 16:08:19 CET 2002


"Jonathan Hogg" <jonathan at onegoodidea.com> wrote in message
news:B875CBFA.36B5%jonathan at onegoodidea.com...
> On 24/1/2002 12:00, in article a2ot19$hg4$1 at serv1.iunet.it, "Alex
Martelli"
> <aleax at aleax.it> wrote:
>
> > Not sure what you mean.  "get the idx1-th element
> > from list llis and remove it from the list too"
> > is llis.pop(idx1); is that what you mean by
> > "comprehend"?
>
> No, I think he meant "make it into a list comprehension". Perhaps:
>
>     llis = [ x for i, x in zip(xrange(len(lis)), lis) if i <> idx1 ]
>
> Though this is substantially uglier than the original version. It can be

And both are horribly uglier than llis.pop(idx1), IMHO...


Alex






More information about the Python-list mailing list