Re:The Future of Clojure
by techdragon on Thursday December 10, 2020 @09:12PM
(#25381437)
What do you mean python doesn’t have good tools to select what you need from a dictionary and keep the original intact, you just use a dictionary comprehension and boom you’re done...
new_dictionary = {__k: __v for __k, __v in original_dictionary.items() if __k not in {‘key1’, ‘key2’, ‘key3’}}
(written on my phone without a repl to double check but the technique is sound and i use it all the time)I disagree about this being good. I think this is ugly as sin. This is an aesthetics point but isn't most of this aesthetics anyways?
I want `select` and `dissoc`. I also would like for those to be performant (instead of requiring a bunch of copies). I don't want to have to choose between expressiveness and performance.
I don't write Clojure in the day-to-day but I think it hits those beats very well.
Some other example, Python and JS are both similar languages in many respects. But even something as simple as not having list comprehensions makes JS more fidgety when you're writing simple code.
Python not having great utils for stuff like "give me this dictionary, but without these three keys, but keep the original dictionary intact" (Clojure has dissoc for this) also makes it a bit fidgety compared to Clojure.
"You can write all of this" maybe, but at one point you're really going upstream from the base language.