* Hi, I am starting with Python object oriented concepts and have difficulty in understanding object instantiation. Below is an example code that I am trying to think/implement. I can create a given student object based on given firstname, lastname and grade. How do I find all objects matching particular criteria and return them to caller? Do I need to iterate/select through some list/database and create Student objects again?
* Sorry that question is not quite clear, but I am confused and not sure how to put it in right words.* * class Student(): * def __init__(self,firstname,lastname,age): * * self.firstname = firstname * * self.lastname = lastname * * self.grade = grade * def set_grade(self,grade): * * self.grade = grade * @classmethod * # Find all Students with given lastname * def find_by_lastname(): * * # How do I return all student objects that have same lastname? * * # Do I need to call init method again? I am confused here. * * pass * Thanks, Jamie * * _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
