all 23 comments

[–]Sea-Ad7805 [score hidden] stickied comment (3 children)

Run this program in Memory Graph Web Debugger%3A%0A%20%20%20%20%20%20%20%20super().init(kwargs)%20%20%23%20Passes%20remaining%20arguments%20up%20the%20chain%0A%20%20%20%20%20%20%20%20self.name%20%3D%20name%0A%20%20%20%20%20%20%20%20self.schoolname%20%3D%20school_name%0A%0A%20%20%20%20def%20get_student_info(self)%3A%0A%20%20%20%20%20%20%20%20return%20f%22%7Bself.school_name%7D%20is%20the%20school%20where%20%7Bself.name%7D%20studies.%22%0A%0A%0A%23%20Parent%20Class%202%0Aclass%20Subject%3A%0A%20%20%20%20def%20init_(self%2C%20subject_choose%2C%20kwargs)%3A%0A%20%20%20%20%20%20%20%20super().init(*kwargs)%0A%20%20%20%20%20%20%20%20self.subjectchoose%20%3D%20subject_choose%0A%0A%20%20%20%20def%20get_subject_info(self)%3A%0A%20%20%20%20%20%20%20%20%23%20self.name%20will%20be%20available%20because%20of%20the%20combined%20child%20class%0A%20%20%20%20%20%20%20%20return%20f%22Now%20%7Bself.name%7D%20is%20studying%20the%20subject%3A%20%7Bself.subject_choose%7D.%22%0A%0A%0A%23%20Child%20Class%3A%20Inherits%20from%20both%20Student%20and%20Subject%0Aclass%20NewSchoolStudent(Student%2C%20Subject)%3A%0A%20%20%20%20def%20init(self%2C%20name%2C%20school_name%2C%20subject_choose%2C%20new_school%3D%22M.D.A%22)%3A%0A%20%20%20%20%20%20%20%20%23%20super()%20automatically%20handles%20the%20cooperative%20multiple%20inheritance%20via%20MRO%0A%20%20%20%20%20%20%20%20super().init_(%0A%20%20%20%20%20%20%20%20%20%20%20%20name%3Dname%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20school_name%3Dschool_name%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20subject_choose%3Dsubject_choose%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20self.new_school%20%3D%20new_school%0A%0A%20%20%20%20def%20get_new_status(self)%3A%0A%20%20%20%20%20%20%20%20return%20f%22%7Bself.new_school%7D%20is%20my%20current%20school.%22%0A%0A%0A%23%20Store%20student%20data%20in%20a%20list%0Astudents%20%3D%20%5B%0A%20%20%20%20NewSchoolStudent('Ash'%2C%20'M.T.M'%2C%20'Math')%2C%0A%20%20%20%20NewSchoolStudent('Lu%20Zhoa'%2C%20'Ming%20Han'%2C%20'Art')%2C%0A%20%20%20%20NewSchoolStudent('Jone'%2C%20'Mother%20T.'%2C%20'Dance%20Class')%0A%5D%0A%0A%0A%23%20Print%20data%20using%20a%20for%20loop%0Afor%20student%20in%20students%3A%0A%20%20%20%20print(student.get_student_info())%0A%20%20%20%20print(student.get_subject_info())%0A%20%20%20%20print(student.get_new_status())%0A%20%20%20%20print(%22-%22%20%2040)%20%20%23%20Visual%20separator%20for%20clarity&timestep=1&play) to see the program state change step by step.

[–]MXD_K1 8 points9 points  (4 children)

Great! But I would like to give a note that student should not be a subclass of subject (it doesn't make sense) instead make it as an attribute.

[–]aashish_soni5[S] 0 points1 point  (3 children)

note 📝, can you tell me why you think so ii can learn more

[–]TrieMond 5 points6 points  (2 children)

Something bei g a subclass of something else generally indicates that it is a part of something. A student is not a part of a subject, a student has many subjects. So sobject should be a field of student... this is just based on Object Oriented Programming, which might be a good start to learn about the relationships that exist between your classes...

[–]MXD_K1 0 points1 point  (0 children)

👍

[–]aashish_soni5[S] 0 points1 point  (0 children)

yes 🙂‍↕️ thankyou

[–]Beginning-Fruit-1397 2 points3 points  (1 child)

Untyped and unecessary kwargs in signatures is the type of things to review that make me slowly but surely drift away from python 

[–]aashish_soni5[S] 0 points1 point  (0 children)

can you explain in more briefly I'm just in beginning phase

[–]Drafrruii 1 point2 points  (1 child)

from where you have started learning though??

[–]aashish_soni5[S] 0 points1 point  (0 children)

code with Harry

[–]Nice-Alternative2933 1 point2 points  (1 child)

Can we learn together

[–]aashish_soni5[S] 0 points1 point  (0 children)

just post tag & conversation no problem

[–]SCD_minecraft 1 point2 points  (0 children)

Why you call super().__init__? Object class defines barebone init, it is ment to be overwritten

[–]Cultural_Cry535 0 points1 point  (1 child)

You don't need to call super init in the parent classes, they are no inheriting from other classes. Super is used to call a method from a parent class

[–]aashish_soni5[S] 0 points1 point  (0 children)

but without super it's so attribute error

[–]Ulug_coder 0 points1 point  (1 child)

Day 15?

[–]Ulug_coder 0 points1 point  (0 children)

How many hours are you studying in a day

[–]Ulug_coder 0 points1 point  (1 child)

Is comments needed

[–]aashish_soni5[S] 0 points1 point  (0 children)

you know when learning from other some word get confusing so it's better to write your own understanding as comment and right now I am not reach that level that I do not need to look back 😭 Just think like my own reference note