top | item 39095254

(no title)

locuscoeruleus | 2 years ago

I think dict(name=name, age=age) can be definitely be more readable and ergonomical to write than {"name": name, "age": age}.

discuss

order

mikepurvis|2 years ago

I still miss coffeescript's ability to do dict(@name, @age) though I understand that it creates an unwelcome coupling between the parameter names and their names in the calling scope.

For my part, those names are often the same anyway, though, since the calling scope names are often arbitrary and might as well match the parameter names.

lights0123|2 years ago

    {name, age}
does the same in modern JS, assigning the variable to the key with the same name.