Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python Advanced Objects Subclassing Built-ins

Conor Fitzgerald
Conor Fitzgerald
9,206 Points

clarification for javascriptobject.py

between 8:50 - 9:20 what the class is doing is being explained. I'm getting confused by the explanation. He says when the try is executed and if the key exists we'll get it from the dict. If the key doesn't exist we fall back on the dict version of getattribute(), which will see if there is a real attribute with that name. I think he means say if the JavaScriptObject class had an attribute called name the dict version of getattribute would look for that if the try failed.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

Correct. Even when running a method of the inherited class using super(), while the method is in the inherited class, it is operating on the current instance of the derived class JavaScriptObject when looking for an attribute not found during the self[item] lookup.

Conor Fitzgerald
Conor Fitzgerald
9,206 Points

Awesome, I just wanted to make sure my understanding was correct. Thank you for the answer and the fast reply!