Hi, It is possible to build a system where the fields are "self defining" : -
One way is to keep a dictionary of tags and descriptors, and to keep "the data" in a dictionary using the same tags as keys, with values - an oversimplified example: DefinitionDict = {1:'Quantity',2:'Price',3:'Value'} DataItemDict = {1:10,2:3.50,3:35.00} This is conceptually not much different to putting headers on columns in a database table or a spreadsheet, with the data item being a row, or to HT or XML. Now obviously the definitions need not be single valued strings, but could be multivalues, for use at different times, such as for gui displaying, for printing, etc, and could also hold type information, as most databases do. Up to this point, there is no a priori human knowledge mixed in with the data that has not been written down. However, when we want to make say a validation rule, such as Quantity times Price must equal Value, then we are using a priori knowledge about the data to formulate this. At this point, if a routine is written to check that DataItemDict[1] multiplied by DataItemDict[2] is indeed equal to DataItemDict[3], then we are casting the meanings into stone, and the flexibility of the structure is to a large extent lost. Now if I want to make a system where these sort of rules, as well as more complicated ones, are also definable - Is there a way to do it simply and cleanly - a way to expand the DefinitionDict so that it contains all of what we know about the structure and relationships of and between the items of data? It seems to me that if this could be done, then it could be used to dynamically generate the routines needed for validation, update, etc... But my brain strains when I try to think about how to do it... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list