special methods we can use the dir(objectfunction to get list of attributes of particular object the methods that begin and end with two underscores are called special methods apart from the following exceptionspecial methodare generally called by the python interpreter rather than the programmerfor examplewhen we use the operatorwe are actually invoking call to __add__(for examplerather than using my_object __len__(we can use len(my_objectusing len(on string object is actually much faster because it returns the value representing the object' size in memoryrather than making call to the object' __len__ method the only special method we actually call in our programsas common practiceis the __init__ methodto invoke the initializer of the superclass in our own class definitions it is strongly advised not to use the double underscore syntax for your own objects because of potential current or future conflicts with python' own special methods we mayhoweverwant to implement special methods in custom objectsto give them some of the behavior of built-in types in the following codewe create class that implements the __repr__ method this method creates string representation of our object that is useful for inspection purposesclass my_class()def __init__(selfgreet)self greet greet def __repr__(self)return ' custom object (% )(self greetwhen we create an instance of this object and inspect itwe can see we get our customized string representation notice the use of the % format placeholder to return the standard representation of the object this is useful and best practicebecausein this caseit shows us that the greet object is string indicated by the quotation marks