find of class an object belongs to in python code example

Example 1: how to get name of class in class python

class SillyClassName:
    @classmethod 
	def my_name(cls_):
		return cls_.__name__

 def class_name(self):
  	# self.__class__ gets the current class
    # .__name__ gets the name
	return self.__class__.__name__

SillyClassName.my_name()
# prints SillyClassName

inst = SillyClassName()
inst.class_name()
# prints SillyClassName

Example 2: how to check if a variable in python is a specific data type

isinstance(variable_name, class_name) #eg. isinstance(age, int) will return True