python instance method on class code example

Example 1: call instance class python

# define class
class example:
# define __call__ function
   def __call__(self):
       print("It worked!")
# create instance
g = example()
# when attempting to call instance of class it will call the __class method
g()
# prints It worked!

Example 2: python instance Object

x.counter = 1
while x.counter < 10:
    x.counter = x.counter * 2
print(x.counter)
del x.counter


#https://docs.python.org/3.8/tutorial/classes.html#class-objects