Python __dir__() Magic Method
Python’s __dir__() magic method implements the functionality of the dir() built-in function. Semantically, dir() returns all (function, object, or variable) names in a given scope. However, the magic method __dir__() converts any return value to a sorted list. Minimal Example The following code defines a custom class My_Class and overrides the __dir__() magic method to … Read more