3 ms·
Not 100% sure what's meant in this specific example but as someone who did advent of code a lot, there are truly benefits of an untyped python dictionary over a
by wink 4y ago
Not 100% sure what's meant in this specific example but as someone who did advent of code a lot, there are truly benefits of an untyped python dictionary over anything in Rust or Java or C++. You can just put None next to your integers without having to wrap in Optional or even worse, a struct.
- still_grokking 4y agoYou can't compare Python to something like Rust, Java, or C++. Compare to for example Scala, that would make more sense.
- ummonk 4y agoJava and C++ don't have type inference. It would surprise me if Rust isn't smart enough to infer that the type of the dictionary is "Optional<Integer>" or "Integer | None". I haven't used Rust myself, but every language that I've used with type inference and algebraic data types will make this inference on its own.
- rowls66 4y agoRecent versions of Java have type inference.