[Tutor] How to generate instance names?

Christopher Singley csingley at gmail.com
Mon Nov 8 23:22:59 CET 2004

> When someone asks this, the answer is almost always they they should use
> dictionaries.

That was my original plan.  However, I am trying to cast my program
along object-oriented lines.

I am writing a Python program to manage a SQL database.  I wish to
represent database tables by object classes, and table rows by
instances of classes.  Object attributes correspond to table columns. 
A SQL query causes object instantiation; since there will be an
unknown number of query results, I'm looking for a way to generate
arbitrary numbers of instances.  I had thought to package the
query-objects into lists and iterate over them; each object in the
list can be processed by invoking its methods.

Is this a doomed plan?  Is there a better way, or a standard solution
for this problem?


More information about the Tutor mailing list