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 trialAnthony Costanza
2,123 PointsHuh? Dunder who?
Dunder Main who?
I'm not gonna lie - up until now - I was doing ok with this Python stuff - but I just feel like there is a giant chunk of info missing to sew this concept up in the mind of a novice - ugh! help please!
2 Answers
Alexander Besse
Full Stack JavaScript Techdegree Graduate 35,115 PointsHi Anthony Costanza!
Python dunder methods are special pre-recognized methods by python that you can place on a class, and are denoted by the double underscore on both sides of the method name.
__init__(self, args..) # Think of this as the constructor of the class. Initialization can be done here.
__len__(self) # The length value you return from here will show when you use `len(classvar)`.
# There are many more dunder methods...
Here is a source to read: https://dbader.org/blog/python-dunder-methods
I haven't taken the python course on Treehouse's platform but I hope that helps. Feel free to reach out for more.
AJ Tran
Treehouse TeacherHi Anthony Costanza , check out this video about Dunder Main: https://teamtreehouse.com/library/understanding-dunder-main-main
I hope you will find it helpful!