3 ms·
dict literals :( Although I read there are crates to help with this, and it's indicative of bad programming styles...
by vonseel 4y ago
dict literals :(
Although I read there are crates to help with this, and it's indicative of bad programming styles...
- masklinn 4y agoYeah I've not been too bothered about missing dict literals so far: in Python dicts act as quick structs, you throw a few items in and carry your unit around. In Rust that's not really an option because the types are so much stricter, and the loss of certainty on the other side makes things less convenient. Instead you'd use a tuple or throw a quick struct together (tuple or not). Defining structs is so habitual that it doesn't really feel unnatural or heavyweight. It's like using dataclasses in Python, except the language also becomes helpful when you do that.