How do I access a private attribute of a parent class from a subclass (without making it public)?
Share
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.
My understanding of Python convention is
Options for if you control the parent class
since that seems like what you really
want
_protected_access_to_member…) to limit the protected access
If you don’t control it
dir(object) you will see names
something like _Class__member which is
what Python does to leading __ to
“make it private”. There isn’t
truly private in python. This is probably considered evil.