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

don't understand self

i don't understand self clearly .please tell me more about self argument.

1 Answer

Steven Parker
Steven Parker
229,968 Points

:point_right: The self argument generally represents the current class instance.

This allows the methods in the class to reference the properties and other methods of the same instance without knowing the instance name. If you haven't programmed in other languages before, it can be a difficult concept to grasp. But if you keep going, I suspect that the additional examples and practice will eventually lead to an "Aha!" moment.

In the meantime, you might take a look at this more detailed explanation on the Python Tips website: The self variable in python explained.