Is there a difference between dir(…) and vars(…).keys() in Python?
(I hope there is a difference, because otherwise this would break the \"
Apart from Answers given, I would like to add that, using vars() with instances built-in types will give error, as instances builtin types do not have __dict__ attribute.
eg.
In [96]: vars([])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 vars([])
TypeError: vars() argument must have __dict__ attribute