3 ms·
I honestly still don't know what `with` does in python. Without looking it up: Since I don't use python all that often, my best guess is that it calls some ma
by throwawaymaths 1y ago
I honestly still don't know what `with` does in python. Without looking it up: Since I don't use python all that often, my best guess is that it calls some magic dunder function? I get that "primitives" like +, - aren't actually and ALSO call dunders, but there's a bit of "ssh don't tell me that and let me pretend" in the python ethos, and writing your own dunder function for anything that isn't number-ish is probably a huge code smell, and probably a potential footgun even if it is numberish. which is why `with` always felt weird to me.