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) Objects __init__

Hara Gopal K
PLUS
Hara Gopal K
Courses Plus Student 10,027 Points

**kwargs is a dictionary ?

where is the dictionary that we are trying to unpack ? is kwargs a dictionary created on-the-fly with class variables/attributes as keys and values ?

1 Answer

Steven Parker
Steven Parker
229,783 Points

The name "kwargs" is commonly used as a parameter name in a method definition.

It represents the dictionary that will be passed in as an argument when that method is called elsewhere in the program. It's generally only used along with the unpacking operator (**) to make it clear that unpacking is being used, and is a best-practice convention and not a language requirement.