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 trialelmira bonab
3,471 Pointswhat is the difference between self.get_weapon() and get_weapon(self)?
Is the only difference the usage of get_weapon(self) in the beginning of method description in a class ? Thanks.
1 Answer
Chris Freeman
Treehouse Moderator 68,454 Pointsself.get_weapon()
calls the get_weapon()
method of an instance of this class.
get_weapon(self)
is used in defining a method, with def
, in a class where the first argument is self
to represent the instance called.
elmira bonab
3,471 Pointselmira bonab
3,471 PointsThanks for your help!