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) Inheritance __str__

Nelson Chuang
Nelson Chuang
1,221 Points

why does he not explain what __class__.__name__ is? I don't get it. there's 4 placeholders but 5 arguments

above

Lamar Greene
Lamar Greene
9,581 Points

Actually, it is still only 4 arguments. The '.' denotes an extension of an existing parameter. (I hope I am using the correct terminology) It works in a similar manner as using the '.' after 'self'.

Look at it as it is visually written in the example. Each argument is on its own line, separated by a comma.

1 Answer

He does explain class . name for ex. the class would be class Dragon and the _name_ is the string version of it. As for the 5 arguments we always have self, the arguments after self are the ones he uses.