- 1
Think of the class as a car factory & the resulting 'object' that is created (instantiated), by the _init_ function, as the car.
*this is a continuation of a comment in the class section of the python tutorial. it will not make much sense without the first half, my apologies. I ran out of room in the comment section so I linked it to here. I hope that doesn't bother anyone and I apologize if it does.* (sorry, ran out of room - here's the rest) #clr & mdl are instance var that are assigned to the class obj being created(self). So, 'car1 = Car(red, sedan)' creates the 'car' & assigns red for clr & sedan for mdl and saves it to car1 so car1.wheels would equal '4' car1.clr would equal 'red' and car1.mdl would be ' sedan'
2 Respostas
0
I did post the entire comment in the class section (this is only the beginning and end) after realizing I had accidentally posted here. however, I ran out of room in the comment section so I left the last part of my comment here with a link to its new location in the comment section.
0
thank you so much, tind. However, I don't think I'll have any more long comments and this seemed to work in this instance.
punny.
but if I do feel the need to post a long comment, I will take your thoughtful advice.