Gerard Flanagan wrote: > What about symmetric 'load' and 'iterrows' methods for the Table class: > > t2 = Table() > t2.load( t1.iterrows("LastName", "Age") ) > > def load(self, iterable): > '''expecting tuples''' > for lname, age in iterable: > self.append( lname, age ) > > def iterrows(self, *args): > '''returns a generator which itself returns tuples > filtered by the column names in *args (via > operator.itemgetter maybe?)''' > > > There might be some value in comparing Microsoft's DataSet API. IIRC, > you typically have: > > *UI* - DataView - DataSet - DataAdapter - *DATABASE* > > A DataSet is a collection of DataTables and has a lot of DB/XML > functionality and so on. A DataView on the other hand is more > lightweight and has mainly filtering and sorting functions and is > designed to be bound to a GUI widget such as a DataGrid. > > You might have something along the lines of: > > ds = DataSet() > # fill ds from datasource > dt_customers = ds.tables["customers"] > view = DataView( dt_customers ) > view.rowfilter = "lastname LIKE 'A*' and Age < 60" > > I'm not saying imitate this, but maybe some value in studying the > OO-bondage approach.
Thank you, this is very good stuff to think about. James -- http://mail.python.org/mailman/listinfo/python-list