data design

Paddy paddy3118 at netscape.net
Tue Jan 30 14:06:25 EST 2007



On Jan 30, 2:34 pm, Imbaud Pierre <pierre.imb... at laposte.net> wrote:
> The applications I write are made of, lets say, algorithms and data.
> I mean constant data, dicts, tables, etc: to keep algorithms simple,
> describe what is peculiar, data dependent, as data rather than "case
> statements". These could be called configuration data.
>
> The lazy way to do this: have modules that initialize bunches of
> objects, attributes holding the data: the object is somehow the row of
> the "table", attribute names being the column. This is the way I
> proceeded up to now.
> Data input this way are almost "configuration data", with 2 big
> drawbacks:
>   - Only a python programmer can fix the file: this cant be called a
>     configuration file.
>   - Even for the author, these data aint easy to maintain.
>
> I feel pretty much ready to change this:
> - make these data true text data, easier to read and fix.
> - write the module that will make python objects out of these data:
> the extra cost should yield ease of use.
>
> 2 questions arise:
> - which kind of text data?
>      - csv: ok for simple attributes, not easy for lists or complex
>      data.
>      - xml: the form wont be easier to read than python code,
>        but an xml editor could be used, and a formal description
>        of what is expected can be used.
> - how can I make the data-to-object transformation both easy, and able
>    to spot errors in text data?
>
> Last, but not least: is there a python lib implementing at least part
> of this dream?
Google for YAML and JSON formats too.
http://www.yaml.org/
http://www.json.org/

-Paddy




More information about the Python-list mailing list