[Python-Dev] Re: Story behind vars() vs .__dict__

2021-01-08 Thread Greg Ewing
On 9/01/21 9:12 am, Chris Barker wrote: (though I notice that if you create __slots__ in pure Python, its names show up in dict anyway -- so clearly I'm confused...) Descriptors for the slots get added to the *class* dict. But that's not the dict that vars() looks at. -- Greg _

[Python-Dev] Re: Story behind vars() vs .__dict__

2021-01-08 Thread Chris Barker via Python-Dev
This was discussed a bit over on python-ideas recently, so a note from me, and one from that thread: Or for that matter, not the reason to provide > object's internal storage via object's attribute: obj.__dict__. > Well, it IS an implementation detail that it's a dictionary, but having a dunder t

[Python-Dev] Re: Story behind vars() vs .__dict__

2020-12-21 Thread Paul Sokolovsky
Hello, On Tue, 22 Dec 2020 01:10:17 +1300 Greg Ewing 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 imple

[Python-Dev] Re: Story behind vars() vs .__dict__

2020-12-21 Thread Greg Ewing
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. -- Greg