If I define:
class Bar(object):
@staticmethod
def bar():
# code
pass
class Foo(Bar):
# code
pass
Is it possible for a function call Foo.bar() to determine the class name Foo?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Replace the staticmethod with a classmethod. This will be passed the class when it is called, so you can get the class name from that.