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
Luca Vicini
Courses Plus Student 8,594 PointsSelf as an argument
In all methods that we define within a class we use the argument self. Why did the language designers decided to declare it explicitly instead of having it defined by default implicitly?
2 Answers
Jeffrey James
2,636 Points(note the comment about Guido, who invented python)
Believe it mainly relates to clarity around instance vs static methods.
Python is also an explicit language which emphasizes one true way to do things. If you've ever written a language like javascript where there are at least 10 ways to do a single thing, sometimes it seems like you are learning 10 languages. (end rant)
Luca Vicini
Courses Plus Student 8,594 PointsHi Jeffrey and thanks for your answer. I read Guido Van Rossum's blog post and I now understand the overall reasons (even though my present knowledge of the language doesn't allow me to understand all the subtleties). I love Python. Like you I don't have a great sympathy for JavaScript. <rant>What annoys me the most in JS are these seemingly unpredictable wild type conversions. Cannot wait for WebAssembly</rant>
Jeffrey James
2,636 PointsRight on. I write python everyday for data analytics stuff and 99% of the time never use classes (outside of trying to debug API issues with various 3rd party modules or packages), fwiw. Good rant tag
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsChanged comment to answer