Jul-12-2018, 04:16 PM
I have a very simple program to create Employee objects:
The reason I ask is because I am making a GUI. My GUI allows users to create new Employees and display there information but only one at a time. So I thought I would build a method that stores each newly created Employee object. However, that got me to thinking... how are they normally being stored>> do I even need to create a new list to store them or does one already exist?
class Employee: def __init__(self, id, salary): self.id = id self.salary = salaryNow lets say I built a method that would create new employee objects: emp1, emp2, emp3 ... empN. I can access these objects attributes like: emp1.id or emp5.salary. My question is, where and how are these objects being stored? Is there some list that is created or some stack that is created in memory such that when I call emp1.id it pops that objects id off the stack or something?
The reason I ask is because I am making a GUI. My GUI allows users to create new Employees and display there information but only one at a time. So I thought I would build a method that stores each newly created Employee object. However, that got me to thinking... how are they normally being stored>> do I even need to create a new list to store them or does one already exist?