Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@ryanmhoffman Agreed. My variable scheme for this isn't the best but "for noun in nouns" is easy to understand.
-
@ryanmhoffman
Common != correct
I only mention because ive done exactly what OP did and its an annoying bug to find but incredibly easy to avoid -
Golang way it. For short usage variables use one/two letters names. So it would be:
for _, i := range items {
i.do()
}
Or pythonic:
for i in items:
i.do() -
May I ask what language you are using?
Python seems to (rather strangely) handle this just fine. -
@TheCapeGreek how that could be? The items from the loop should be local scope, when items in 'in items' were already assigned global scope
-
@afrometal It does make little sense I agree. But fixing that stopped crippling our server and subsequently all the other sites we host.
Related Rants
Typos kill, kids! And deploying to production.
Instead of "for item in items" in my script, I accidentally did "for items in items". Thus, an exponential loop has been entering things into the database for the past few hours before I found the place to fix it.
By the way, this runs on cron every minute. So there are processes still running exponentially right now, possibly 180+.
Yeah, I'm setting up a a test server instead now.
rant
typo
test in prod
noob