Is vars() the most useless Python built-in ever?

Serhiy Storchaka storchaka at gmail.com
Fri Dec 4 03:42:16 EST 2015


On 02.12.15 11:28, Chris Angelico wrote:
> On Wed, Dec 2, 2015 at 7:22 PM, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> On 01.12.15 03:00, Steven D'Aprano wrote:
>>> I'm trying to understand why vars() exists. Does anyone use it?
>> I use vars() exclusively for introspection in interactive environment. As
>> well as dir() and help(). Sad that it doesn't work with __slots__.
> Maybe the upshot of all this is a post to python-ideas recommending
> that vars() grow support for __slots__ types? If it's most often used
> interactively, this would make it more useful there, and it wouldn't
> break backward compatibility unless there's some way that people are
> depending on it raising an exception.

It already was discussed few times. And there is even open issue for 
this: http://bugs.python.org/issue13290.





More information about the Python-list mailing list