Need help porting Perl function

kj socyl at 987jk.com.invalid
Sun Jun 8 12:52:54 EDT 2008


In <g2h2kb$43g$1 at reader2.panix.com> kj <socyl at 987jk.com.invalid> writes:

>In <7248c81b-0ff9-45f5-acb5-63a8b2d41817 at f24g2000prh.googlegroups.com> John Machin <sjmachin at lexicon.net> writes:

>>It's nothing to do with list comprehensions, which are syntactical
>>sugar for traditional loops. You could rewrite your list comprehension
>>in the traditional manner...
>>and it would still fail for the same reason: mutating the list over
>>which you are iterating.

>I normally deal with this problem by iterating backwards over the
>indices.  Here's how I coded the function (in "Python-greenhorn
>style"):

***BLUSH***

Somehow I missed that John Machin had posted almost the exact same
implementation that I posted in my reply to him.

Reading too fast.  Reading too fast.

Kynn

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.



More information about the Python-list mailing list