On Tue, 22 Dec 2020 01:10:17 +1300 Greg Ewing firstname.lastname@example.org wrote:
On 22/12/20 12:36 am, Paul Sokolovsky wrote:
Expected clarification on ".__dict__ breaking object encapsulation":
Encapsulation is not something that Python has ever been big on. There are plenty of places where implementation details are exposed, and we don't regard that as a problem.
That's still not the reason to e.g. make the value of the proverbial LOAD_METHOD opcode be available via dict type attribute, like: dict.LOAD_METHOD. Or for that matter, not the reason to provide object's internal storage via object's attribute: obj.__dict__.
But the question was about (thru-the-time) relationship of vars() vs .__dict__ ...