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 Basic Object-Oriented Python Welcome to OOP Instance Attributes

Luis Gutierrez
seal-mask
.a{fill-rule:evenodd;}techdegree
Luis Gutierrez
Python Development Techdegree Student 2,820 Points

Why is the make argument from the def __init__():; Called first when it's the last parameter?

Using chatgpt without any other block of code. the def init(): suggests to be left at the end of the attributes.

1 Answer

Steven Parker
Steven Parker
232,149 Points

Be careful about using ChatGPT (or any AI) in conjunction with the lessons, as it is notorious for getting confused and providing incorrect analysis.

But I'm wondering if you stopped partway through the lesson, because at first "make" was defined as the first parameter (after "self") but later is was moved to the end. For a few minutes the calling sequence in the code still reflects the original order, but before the lesson ends it is also rearranged to place "make" last. You might notice that the code is only executed after all changes are made and not while the reordering is still being done.

Luis Gutierrez
seal-mask
.a{fill-rule:evenodd;}techdegree
Luis Gutierrez
Python Development Techdegree Student 2,820 Points

Yeah so. I didn't wrote the question properly. so why default arguments are called first in the instance of the initialization. or is there any specific order for the call of the instance attributes and the arguments?

Steven Parker
Steven Parker
232,149 Points

The "self" argument is always first (and isn't explicitly passed when you create an instance). The rest are ordered as you want them to be passed in.

If that doesn't clear it up, perhaps you could show some code examples to illustrate what you are asking about.