in java we can have objects of class and Method. how we can achieve same in python.
Example (in java) """Class cls=Class.forName("Test.class"); Method method = Test.class.getMethods()[];"""
You can create the class by reflection.
And with inspect built-in module, you can get methods:
import inspect
class MyClass:
def __init__(self):
self.a = "default"
def method_1(self):
pass
my_second_way_to_call_class = globals()["MyClass"] #reflection
my_third_way_to_call_class = MyClass # assignation of the object def
instance_1 = MyClass()
instance_2 = my_second_way_to_call_class()
instance_3 = my_third_way_to_call_class()
method_list = inspect.getmembers(instance_1, predicate=inspect.ismethod)
print(method_list)
type(),dir(),isintstance(),callable(),getattr(),setattr()and others. But there is no such Java'ic thing like class of class, because everything in python is an object (even classes)