Remix.run Logo
gabrielsroka 21 hours ago

Not very Pythonic

  for i in range(len(records)):
    scores[i] = score(records[i])
Better

  for i, record in enumerate(records):
    scores[i] = score(record)
Best

  scores = [score(record) for record in records]
Raymond Hettinger (Python core dev): https://gist.github.com/bespokoid/205efd91546ddb16b210678830...
soumik15630m 12 hours ago | parent [-]

Sure those are good designs... But Lucen is not about "here's a nicer way to write loops," it's "you shouldn't have to touch the loop you already have."..... showing Lucen parallelize the ugly version is the point.

gabrielsroka 7 minutes ago | parent [-]

I get it, but I'd never write it like that.

Does it support list comprehensions, etc?