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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Allison Welch](https://uploads.teamtreehouse.com/production/profile-photos/11708934/micro_94CF7808-55DF-4BE0-90E7-091D51833A1B.jpg)
Allison Welch
3,256 PointsWhy is 'is_hungry' attribute not included inside __init__?
Is it because it's always true? If that's the case, then why wouldn't you put it at the top with the other attributes instead of inside the init method?
# insert your code here
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
def __init__(self):
self.is_hungry = True
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThe variables "at the top" are class variables, and are shared by all instances of the class. This makes sense for something like "species", since all pandas will be the same species.
The variables declared inside the __init__ method (and referenced through "self.") are instance variables, and are unique for each instance. This makes sense for something like "is_hungry" since all pandas may not be hungry at the same time, even though every newly created one starts out that way.
Allison Welch
3,256 PointsAllison Welch
3,256 PointsYes, as I worked through some of the later videos it makes more sense now. Thank you for your response!
Steven Parker
230,688 PointsSteven Parker
230,688 PointsAllison Welch — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!