Hacker News new | ask | show | jobs
by falcor84 1803 days ago
I agree in general, but just wanted to add that the pythonic approach would be to avoid the explicit index entirely, with something like:

alternate_word_mapping = dict(zip(words, words_in_english))

2 comments

Thumbs up, I totally missed this. Didn’t encounter this approach in the suggestions either.

That’s actually one reason why I don’t think it’s current incarnation is a good fit for learning new apis, it’s been trained on a lot of code, not all of it good.

Seems like something a future version might be able to fix, perhaps by training a new layer using just demonstrably ‘good’ code?

Agreed and an excellent point. Ironically, my example was not nearly as Pythonic as it could have been!

(V late reply as still learning how to keep track of replies on HN. But perhaps you’ll see it anyway.)