Special Method and Singleton Class in Python
Every Python class has some special method start with __ and end with __. Let’s start with a empty class and see what is special methods are defined in it. class EmptyClass: pass if __name__ == "__main__": print(dir(EmptyClass)) Here is the output of it. [‘__class__’, ‘__delattr__’, ‘__dict__’, ‘__dir__’, ‘__doc__’, ‘__eq__’, ‘__format__’, ‘__ge__’, ‘__getattribute__’, ‘__getstate__’,…
View On WordPress













