News for hackers. Stuff that matters.
Re:Python is not a great programming language by grzm on Saturday October 12, 2019 @05:20PM (#21236409)

    dic = {k: v for k, v in dic.items() if k in other_dic and v == "bar"}
> "How could that be improved? That's 3-4 LOC minimum in any other language"

If I'm understanding the comprehension correctly,

    (into {} (filter (fn [[k v]] (and (get other-dic k) (= v "bar"))) dic))

Though, for readability, I'd likely write it as:

  (->> dic
       (filter (fn [[k v]]
                 (and (get other-dic k)
                      (= v "bar"))))
       (into {}))
Legibility is in the eye of the beholder.
Re:Python is not a great programming language by genidoi on Saturday October 12, 2019 @05:23PM (#21236426)
Each to their own, but both the snippets you posted crossed my threshold for headache inducing parentheses tracking
Re:Python is not a great programming language by grzm on Saturday October 12, 2019 @05:24PM (#21236434)
Similarly, my parsing of special-case syntax in the Python.
Re:Python is not a great programming language by genidoi on Saturday October 12, 2019 @05:26PM (#21236450)
What special-case syntax? The only brazenly pythonic thing in there was the (iterative) tuple unpacking, as in

(for) k, v in dic.items()

which is just

k, v = (<key>, <value>) for every key value pair in the dictionary

Re:Python is not a great programming language by grzm on Saturday October 12, 2019 @05:32PM (#21236496)
There are a number of precedence rules you need to keep track of to parse the list comprehension. There are two different syntaxes that do the same thing. Arguably you need to do the same if you don't already know how the threading macro in the my second example works.

I posted due to your claim regarding all other languages necessitating increased verbosity. I should have left it lie, as I didn't intend to promote a language war, just to post a counter example. My apologies.

Re:Python is not a great programming language by genidoi on Saturday October 12, 2019 @05:48PM (#21236594)
No language war intended, just curious how something I see as a wheel could be improved.