Given a class type, I'd like to get its name and print it to console. I have access to the class type but not an instance.
class Foo:
pass
def print_class_names(klass):
print(klass.__some_dunder?__) # don't know how to do this
print_class_name(Foo) # would like this to print "Foo"
Bonus:
I would also like to access inherited types and generic type, so, for example, if I have list[Foo]
I could access "list" and "Foo" as separate strings.
I can directly print the class like print(Foo)
but that gives me <class '__main__.Student'>
and I'd like to avoid string manipulation if possible.