[Tutor] Recursion and List Comprehensions
Carroll, Barry
Barry.Carroll at psc.com
Sat Oct 29 03:44:28 CEST 2005
Andrei:
>Date: Sat, 29 Oct 2005 01:13:45 +0200
>From: Andrei <project5 at redrival.net>
>Subject: Re: [Tutor] Recursion and List Comprehensions
>To: tutor at python.org
>Message-ID: <djubbd$m91$1 at sea.gmane.org>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
<<snip>>
>There's nothing magic about writing a list comprehension - they're just
>an inside-out way of writing a for-loop :).
<<snip>>
That was just what I needed. Your description was clear and easy to follow.
>4 lines of perfectly readable code have become 4 lines of perfectly
>unreadable list comprehension. Any reader interested in understanding
>this will have to perform the exact opposite set of operations to go
>back to the original code.
<<snip>>
I couldn't agree more. This was a learning exercise for me. In a real
program (one that I or someone else would have to maintain a year or so from
now) I would have stopped with the first version, with all the loops and
intermediate variables left in.
Thanks for your help. I really enjoy this list.
Barry
More information about the Tutor
mailing list