data design

BJörn Lindqvist bjourne at gmail.com
Wed Jan 31 11:38:01 CET 2007


On 1/31/07, James Stroud <jstroud at mbi.ucla.edu> wrote:
> [copy_files]
> files_dir1 = this.file that.file
> path_dir1 = /some/path
>
> files_dir2 = the_other.file yet_another.file
> path_dir2 = /some/other/path
>
> In yaml, it might look thus.
>
> copy_files :
>       - files : [this.file, that.file]
>         path  : /some/path
>       - files : [the_other.file, yet_another.file]
>         path  : /some/other/path
>
> Both are readable (though I like equals signs in appearance over
> colons), but yaml doesn't require a lot of string processing to group
> the files with the paths. I don't even want to think the coding
> gymnastics required to split all of the option names and then group
> those with common suffixes.

But is not that a perfect world example? Consider:

[copy_files]
files_dir1=this.file that.file
path_dir1=/some/path
files_dir2=the_other.file yet_another.file
path_dir2=/some/other/path

versus:

copy_files:
-files:[this.file,that.file]
path:/some/path
-files:[the_other.file,yet_another.file]
path:/some/other/path

Mandatory indentation is good in programming languages, but does it
really belong in configuration files? With tabs verboten to boot.

-- 
mvh Björn



More information about the Python-list mailing list