Re: Need help porting Perl function

2008-06-08 Thread kj
In [EMAIL PROTECTED] John Machin [EMAIL PROTECTED] 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

Re: Need help porting Perl function

2008-06-08 Thread kj
In [EMAIL PROTECTED] kj [EMAIL PROTECTED] writes: In [EMAIL PROTECTED] John Machin [EMAIL PROTECTED] 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

Re: Need help porting Perl function

2008-06-08 Thread Vlastimil Brom
2008/6/7, kj [EMAIL PROTECTED]: ... The original Perl function takes a reference to an array, removes from this array all the elements that satisfy a particular criterion, and returns the list consisting of the removed elements. ... Just out of curiosity, as I didn't find any mention of

Need help porting Perl function

2008-06-07 Thread kj
Hi. I'd like to port a Perl function that does something I don't know how to do in Python. (In fact, it may even be something that is distinctly un-Pythonic!) The original Perl function takes a reference to an array, removes from this array all the elements that satisfy a particular

Re: Need help porting Perl function

2008-06-07 Thread Daniel Fetchinson
Hi. I'd like to port a Perl function that does something I don't know how to do in Python. (In fact, it may even be something that is distinctly un-Pythonic!) The original Perl function takes a reference to an array, removes from this array all the elements that satisfy a particular

Re: Need help porting Perl function

2008-06-07 Thread kj
This function will take a list of integers and modify it in place such that it removes even integers. The removed integers are returned as a new list snip Great! Thanks! kynn -- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it,

Re: Need help porting Perl function

2008-06-07 Thread eatrnr
On Jun 7, 2:42 pm, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi.  I'd like to port a Perl function that does something I don't know how to do in Python.  (In fact, it may even be something that is distinctly un-Pythonic!) The original Perl function takes a reference to an array, removes

Re: Need help porting Perl function

2008-06-07 Thread Sam Denton
kj wrote: Hi. I'd like to port a Perl function that does something I don't know how to do in Python. (In fact, it may even be something that is distinctly un-Pythonic!) The original Perl function takes a reference to an array, removes from this array all the elements that satisfy a particular

Re: Need help porting Perl function

2008-06-07 Thread Paul McGuire
On Jun 7, 1:24 pm, kj [EMAIL PROTECTED] wrote: The original Perl function takes a reference to an array, removes from this array all the elements that satisfy a particular criterion, and returns the list consisting of the removed elements.  Hence this function returns a value *and* has a major

Re: Need help porting Perl function

2008-06-07 Thread John Machin
On Jun 8, 6:05 am, [EMAIL PROTECTED] wrote: On Jun 7, 2:42 pm, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi. I'd like to port a Perl function that does something I don't know how to do in Python. (In fact, it may even be something that is distinctly un-Pythonic!) The original

Re: Need help porting Perl function

2008-06-07 Thread eatrnr
On Jun 7, 5:56 pm, John Machin [EMAIL PROTECTED] wrote: On Jun 8, 6:05 am, [EMAIL PROTECTED] wrote: On Jun 7, 2:42 pm, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi.  I'd like to port a Perl function that does something I don't know how to do in Python.  (In fact, it may even be

Re: Need help porting Perl function

2008-06-07 Thread John Machin
On Jun 8, 8:17 am, [EMAIL PROTECTED] wrote: On Jun 7, 5:56 pm, John Machin [EMAIL PROTECTED] wrote: On Jun 8, 6:05 am, [EMAIL PROTECTED] wrote: On Jun 7, 2:42 pm, Daniel Fetchinson [EMAIL PROTECTED] wrote: Hi. I'd like to port a Perl function that does something I don't