Thanks to you both for the suggestions. I think I'll try the approach
below. But just one follow-up: should I be setting "self.tablename",
or is a static attribute ("tablename") the correct approach?
> A nice way to do this is with a class attribute. For example:
> class Committee(object):
>
> def get_data(self):
> sql = """
> select id, name
> from table_'%(tablename)s'
> """ % {'tablename':self.tablename}
>
> class CandidateCommittee(Committee):
> tablename = 'CandidateTable'
>
> PresidentialCommittee(Committee):
> tablename = 'PresidentialTable'
>
> When you call Committee.get_data() it will get tablename from the
> class of the instance being used.
>
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor