in python what\'s the difference between dir() function and __dir__ attribute in python?
dir()
__dir__
&
dir calls __dir__ internally:
dir
In [1]: class Hello(): ...: def __dir__(self): ...: return [1,2,3] ...: In [2]: dir(Hello()) Out[2]: [1, 2, 3]