Hello Community,
I’m having trouble understanding why the following query fails. I’ve run this in the editor a few times but it’s still not clicking conceptually. It returns the following error message “AttributeError: ‘A’ object has no attribute ‘__a’”
Can someone please help me understand?
I’m having trouble understanding why the following query fails. I’ve run this in the editor a few times but it’s still not clicking conceptually. It returns the following error message “AttributeError: ‘A’ object has no attribute ‘__a’”
Can someone please help me understand?
class A: def __init__(self, v): self.__a = v + 1 a = A(0) print(a.__a)
Larz60+ write Jun-19-2021, 02:50 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.