Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

(not the parent)

agree on the appending to a list. that’s an obvious code smell of “i didn’t know how to do idiomatic python iteration when i wrote this”.

i disagree that the format of the list comprehension above is easier to read than a generator function personally.

however, it’s definitely easier to read than most multi-loop list comprehensions i’ve seen before (even with HN formatting sticking the x.items() on a new line :/ ).

so i see what you’re getting at. it is definitely better. i just find it weird that the the tuple definition comes before the thing i’m doing to get the tuple. sometimes i have to think “backwards” while reading it. i don’t like thinking while reading code. it makes it harder to read the code. and that “thinking” effect increases when the logic is complicated.



> i just find it weird that the the tuple definition comes before the thing i’m doing to get the tuple.

I'll have to give you that one, after ten years of professional development it still feels backwards to me as well.

I think we can blame the math people for that one: {x + 2 ∣ x ∈ N, x < 10}




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: