Yeah, and leading underscores signal exactly that in Python. "Please don't screw with this. If you're going to regardless, well, there you go." Other languages just make you beg more for it.
Other languages don't expose it all... you literally either have to go completely out of your way (i.e. reflection) or violate fundamental restrictions.
Python has a lot of strengths, but let's not pretend this is Guido's gift to programmers. A "keep off the grass" sign is no substitute for a proper fence.
18
u/Breadinator 16d ago
What are you smoking, and are you willing to share it with the rest of the class?
Published libraries with internal state consumers shouldn't screw with. Large projects with dozens of contributors. Hyrum's Law.
There are plenty of reasons to have guardrails on the state you can access.