So let’s say you have something like this:
Class Person:
height = """6' 0"""
and
Henry = Person
What do I have to define in the class to do Henry and get '6' 0"' and not something like <class __main__.Person 0x00012040>?
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.
First, you need to instantiate the class.
Then, you need to define the
__repr__()method.And finally, you need to make it an instance attribute, not a class attribute.