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 (retired) Objects Instantiate

Using parenthesis while creating instance of a class

I tried making an instant of a class without using parenthesis, for e.g.

blue = Monster

It worked. In fact, I could call in all the attributes of the class Monster simply using the same format as in the video.

blue.hitpoints 1

But when I try to change the attribute for blue instance and create a new instance of the class

blue.hitpoints = 5 blue.hitpoints 5

ruby = Monster ruby.hitpoints 5

This changes the attributes in the class as well.

This remained unchanged when I created a new instance using parenthesis

firedragon = Monster() firedragon.hitpoints 5

Can you please explain what is happening? I realize that if we have to change the attribute in the class definition, we can create a new instance without using parenthesis and then modify the attribute. But I am not sure if that is the exact case, or just some small subset of a larger concept.