creating new objects with references to them

JohnJSal johnjsal at gmail.com
Thu Nov 2 16:15:49 CET 2006


It seems like what I want to do is something that programmers deal with
everyday, but I just can't think of a way to do it. Basically, I am
writing a DB front-end and I want a new "Researcher" object to be
created whenever the user presses the "New Record" button. He can open
as many new records at a time as he wants and fill in the information.

What I don't know how to do is handle this arbitrary number of objects.
When it comes time to save the data to the DB, how do I access each
object (to get the text fields associated with each)? Won't I have to
have given each instance some name? Or is there some other way to do
this? Simply creating a new instance each time the user presses "New
Record" won't be good enough, because how do I retain a reference to
that instance over the course of the program, even after a second or
third instance has been created?

Hope that makes sense. It seems like such a common task.

Thanks.




More information about the Python-list mailing list