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!
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

André Nårstad
2,951 PointsTeacher's note
I tried the code from the teacher's note. But when running the code I got an AttributeError: 'NewClass' object ha no attribute 'name'
Wondered if the code in the method:
def name_method(self):
return self.name
should be:
def name_method(self):
return self.name_method
Any comment on this?
[MOD: added ```python formatting -cf]

André Nårstad
2,951 PointsIt from "Object-Oriented Python" > "Instant Objects" > "What Are Objects And Classes?"

Chris Freeman
Treehouse Moderator 68,390 PointsCan you please provide your complete code you’re trying to run?
1 Answer

Chris Freeman
Treehouse Moderator 68,390 PointsYou are correct!!. The teacher’s notes for What are Objects and Classes lists the code:
class NewClass:
name_attribute = "Kenneth"
def name_method(self):
return self.name
The method should be referencing self.name_attribute
and not self.name
Good catch!!
KRIS NIKOLAISEN
54,944 PointsKRIS NIKOLAISEN
54,944 PointsCan you provide link to the page with the note?