[Tutor] Fixing garbled email addresses

Ben Sherman bensherman at gmail.com
Tue May 1 17:06:52 CEST 2007


On 5/1/07, Dotan Cohen <dotancohen at gmail.com> wrote:
>
> [snip]
> >
> > List comprehensions are the best thing ever!
> >
> > Happy to help,
> > Ben
> >
>
>
> With Gmail one must be careful and check that the To and Subject
> fields contain what you'd expect.
>
> Does 'list comprehension' mean a detailed explanation of the code? If
> so, then I'll be reading a lot of them in the near future. I really do
> appreciate the dedication and attention to detail. Thanks.
>
>

List comprehension are a python/programming term.  They allow one to make a
list without generating a blank one and appending to it. A very basic
example:

newlist = [item for item in spam(eggs)]

is the same as

newlist = []
for item in spam(eggs):
    newlist.append(item)

If you walk through the code from earlier, you can see where a list
comprehension saved some lines and made the flow easier to read.

Official documentation is here: http://docs.python.org/tut/node7.html(section
5.1.4)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070501/4f95d0b5/attachment.htm 


More information about the Tutor mailing list