[Python-Dev] listcomps vs. for loops

Michael Hudson mwh at python.net
Tue Oct 21 07:41:00 EDT 2003


Guido van Rossum <guido at python.org> writes:

> I don't recall what I said then.  Did I say it was a feature that
>
>   L = [x for x in R]
>   print x
>
> would print the last item of R?

A problem with such code irrespective of anything else is that it
fails when R is empty.

Cheers,
mwh

-- 
  Whaaat? That is the most retarded thing I have seen since, oh,
  yesterday                             -- Kaz Kylheku, comp.lang.lisp



More information about the Python-Dev mailing list