From: Julian Leviston Date: 2011-08-10T09:36:26+09:00 Subject: Re: *WHY* does this not work? Editing the contents of an array while you're iterating it is generally considered bad programming practice... Because if you delete things, indexing becomes unpredictable. Using copies of arrays is usually a better practice generally. Blog: http://random8.zenunit.com/ Twitter: http://twitter.com/random8r Learn: http://sensei.zenunit.com/ New video up now at http://sensei.zenunit.com/ real fastcgi rails deploy process! Check it out now! On 10/08/2011, at 5:38 AM, serialhex wrote: > ok, many responses, all very good and reasonable, but i guess my point is > kinda missed so i'll explain deeper... > > here is an awesome kludge of a program i wrote last night: > https://gist.github.com/1133359 > > yes it's ugly, and yes it's horrible, but it's not meant to be used for > anything more than what it was used for (which is quickly converting python > to ruby, and give kinda workable results most of the time, and since it's > simply single file programs that i was going to edit & fix later, i'm not > worried as to how ugly the translator is, or the translation, it just did > 90% of my work for me) > > look at the strip_python_loads method, that is the *best* way i can come up > with at the moment. yes i know there are better ways (to write this and the > entire program) but what are they? if i wanted to edit the contents of an > array while iterating through it how do it do it besides that? like i said, > a method such as each! which will allow you to modify the receiver would be > nice... > hex > > p.s. oh, and if you want to fork & edit that gist to make it prettier & more > useful feel free to do so! > > > -- > my blog is cooler than yours: serialhex.github.com > > The wise man said: "Never argue with an idiot. They bring you down to their > level and beat you with experience." > >>> Other than the fact Linux has a cool name, could someone explain why I >>> should use Linux over BSD? >> >> No. That's it. The cool name, that is. We worked very hard on >> creating a name that would appeal to the majority of people, and it >> certainly paid off: thousands of people are using linux just to be able >> to say "OS/2? Hah. I've got Linux. What a cool name". 386BSD made the >> mistake of putting a lot of numbers and weird abbreviations into the >> name, and is scaring away a lot of people just because it sounds too >> technical. > -- Linus Torvalds' follow-up to a question about Linux