News for hackers. Stuff that matters.
Re:Git log in JSON format by wingerlang on Sunday July 12, 2015 @05:08AM (#9872977)
First example is way, WAY, more readable. Honestly, if I didn't read the first one I would probably not have figured out what the other one does without research.
[dead]
Re:Git log in JSON format by wingerlang on Sunday July 12, 2015 @08:04AM (#9873213)
> Which is really easy to read if you understand english

Maybe I missed something, but how does this

> [fn(i) for i in data]

read easier if you know english? You need to know the syntax of "[...]" to know what it does.

The top/first example, however, actually reads like english.

Re:Git log in JSON format by tschuy on Sunday July 12, 2015 @09:24AM (#9873409)
List comprehension are a very common thing in Python.

If you knew Python you'd know exactly what that means. But zokier is right, a map is probably a better choice here.

Re:Git log in JSON format by merb on Sunday July 12, 2015 @01:51PM (#9874262)
I never talked about fn(i) for i in data. That's pythonic as somebody explain but the map one is the most readable and appears in more and more languages, even Java.
Re:Git log in JSON format by s_kilk on Sunday July 12, 2015 @10:52AM (#9873643)
>> You need to know the syntax of "[...]" to know what it does.

Anyone with even a basic understanding of python (the language of the examples we've been discussing here) should know this syntax. If they didn't I'd be worried.