Y
Hacker News
new
|
ask
|
show
|
jobs
by
andreareina
1455 days ago
Clojure also makes working with hashes a whole lot more ergonomic with destructuring and symbol keys.
1 comments
fastball
1455 days ago
Could you clarify a bit here? Python also has destructuring for its dicts and I'm not entirely sure what you mean by symbol keys.
link
andreareina
1455 days ago
Python has tuple destructuring, which can be used with dict.items(). I'm talking about being able to destructure by name not position:
name, address = some_dict
You could fake it if you could ask for a tuple of specific entries:
name, address = some_dict.pluck("name", "address")
link
geysersam
1455 days ago
Symbol keys are string keys for the more sophisticated among us. See :some-name vs "some_name". ;)
link
iamevn
1454 days ago
they're closer to a (namespace) global enum imo
link