Dynamically creating attributes and methods

user at domain.invalid user at domain.invalid
Wed Oct 29 17:24:52 EST 2003


Hi,

I'm writing a DBI for my company's database.
I will have one class for each of the tables
in the database.

I would then like each class, once instantiated,
to be able to read the field list from it's table,
and create properties based on each field, with
get/set methods created for accessing.

The get/set methods could be the same for every
field, provided that I can determine the name
of the field(property) being accessed.

Given a field name such as 'phone', how can I
give the class a home property, and then attach
that property to the get/set methods on the fly?

Thanks,

Toby





More information about the Python-list mailing list