Collections of non-arbitrary objects ?
larry.bates at websafe.com
Thu Jun 21 20:52:29 CEST 2007
> Python seems to have a log of ways to do collections of arbitrary
> objects: lists, tuples, dictionaries. But what if I want a collection
> of non-arbitrary objects? A list of records, or something like that?
Code the record as an object (class) and place instances of those objects inside
a list or dictionary (depending on access required). Or if you don't want to do
much with the records just put each instance of a record (normally a record is
implemented as a tuple at least thats how SQL databases return rows) inside a
list or a dictionary (again depending on access required).
More information about the Python-list