Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python Advanced Objects Subclassing Built-ins

Sohail Mirza
Sohail Mirza
Python Web Development Techdegree Student 5,158 Points

override init

Not sure where to start from. but bascially when kenneth talks begins to talk about the init (4.30) and create the class Fillledlist he says the following So, first things first, let's go ahead and super, and then init. And we're going to ignore everything that was passed in. I don't care what they gave me. All I want is an empty list when I get to the end of this, okay? So at this point, right now, I have a brand new, empty list instance, stored inside of self.

what does he mean we are going to ignore everything and i want is a empty list this sounds very confusing..could someone please explain

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 68,227 Points

Kenneth means: "All I want is an empty list when I get to the end of [creating the list using the super command]" and "we are going to ignore everything passed in (count, value, and any arbitrary positional arguments and keyword arguments) for now. We'll use the count and value later on".

*args absorbs any additional positional arguments and puts them in the tuple args, and **kwargs absorbs all of the additional keyword arguments and puts them into the dict kwargs

The self attribute points to the newly created list.

Post back if you need more help. Good luck!!

Ali Al Dairawi
Ali Al Dairawi
1,869 Points

Chris Freeman thank you for your explanation.