> I think you may have misunderstood the purpose of vars(). It isn't to be
> a slightly different version of dir(), instead vars() should return the
> object's namespace. Not a copy of the namespace, but the actual
> namespace used by the object.
>
> This is how vars() currently works:
>
> py> clas
On Mon, Jan 22, 2018 at 09:20:16AM -0500, Yahya Abou 'Imran via Python-ideas
wrote:
> On top of this old proposition:
> https://bugs.python.org/issue13290
>
> We could have a __vars__ method that would be called by vars() if defined.
> The use cases:
>
> 1. let vars() work with instances without
On top of this old proposition:
https://bugs.python.org/issue13290
We could have a __vars__ method that would be called by vars() if defined.
The use cases:
1. let vars() work with instances without __dict__;
2. hide some attributes from the public API.
Example for 1:
class C:
__slots__