I'm guessing but if insertion_ctx.problem.extras.get_capacity_keys() returns a Some the if executes right? With capacity_keys being assigned to the data in Some. Not really used Rust before.
My point is mainly that I can't reason it out easily with what looks like a double assignment. I find the syntax weird. I guess it's somewhat equivalent to our asspressions
I basically gave you that link because I don't trust my own interpretation of what let max_load_key = if let Some(capacity_keys) = insertion_ctx.problem.extras.get_capacity_keys() does
I can't even find an example like that in the official docs :/
Actually, if I just read it as if Some(X) and get rid of the let, it makes more sense. Basically, if it falls through the match statement to the default (since match has to exhaustive), that is falsey so it goes into the else branch. I've not used match in Python but from PEP 636 it doesn't look like it has to be exhaustive in python
@roganjosh Does it help you to know this is an assignment from a ternary? So the way you would do a if (a := foo.bar.get("qux")) is not None else [] in Python with its do-if-else order, you have if let Some(a) = v {a} else {[]} in languages that use if-do-else orderng.
@Aran-Fey I think you are supposed to, but none of the arguments for that have been convincing for me.
@MisterMiyagi I think so. From this bit of chatter I think I've rubber-ducked myself into following the logic. I still find it a bit mentally-jarring regardless with the use of "let" with two "=" because that signals my thoughts into "there's an assignment here" but obviously with the ternary, that might never be
I actually think the python assignment expression syntax wins out here
Switched to linux (again) for a day and (again) spent the whole day searching for, reading, and altering various text files because apparently linux has never heard of GUIs or user-friendliness
Me: "Install vscode" Linux: "Install vscode and make it the default app for opening folders, got it" Me: "... hey google, can you help me out here? Yeah, he did it again. Yes, this is the 3rd time"
@Aran-Fey I mean, it depends on the distro. Sounds to me like you're using a GUI file manager and the MIME type has been changed too. This is related: unix.stackexchange.com/questions/578248/…
I mean, in a way they are right, but also, not really. This mostly depends on the file manager and how the MIME type is updated by the application (vscode). So you can fix this problem or even not find it on other distro easily
see this is why I always do file management in the terminal 🤷♂️ it's just less hassle but maybe that's just me
True, but that could be applicable to most things...there probably at least one thing that break at least once in an entire year when it comes to software stack, even outside linux
everything is either badly made, decently made but misses key features, or work just well enough until you need something to fix or an additional feature.