Let's say I have this :
class whatever(object):
def __init__(self):
pass
and this function:
def create_object(type_name):
# create an object of type_name
I'd like to be able to call the create_object
like this:
inst = create_object(whatever)
and get back an instance of whatever
. I think this should be doable without using eval
, I'd like to know how to do this. Please notice that I'm NOT using a string as a parameter for create_object
.