8 ms·
From the article: I’ve been reviewing lot of code lately for various open source and internal projects written in Python. As part of those review
by codeape 14y ago
From the article:
I’ve been reviewing lot of code lately for various open
source and internal projects written in Python. As part of
those reviews, I have noticed what I think is a trend
toward using dict() instead of {} to create dictionaries. I
don’t know exactly why this trend has emerged.
My guess for why this trend has emerged: People prefer javascripts object literal syntax where the attribute names are not quoted.
After writing javascript:
var o = { a: 1, b: 2};
... it feels a bit clunky to write Python:
o = { "a": 1, "b": 2}