Best way to store config or preferences in a multi-platform way.
Ivan Illarionov
ivan.illarionov at gmail.com
Thu May 1 13:30:49 EDT 2008
On Thu, 01 May 2008 09:45:28 -0700, Carl Banks wrote:
> On May 1, 12:11 pm, Jon Ribbens <jon+use... at unequivocal.co.uk> wrote:
>> On 2008-05-01, Ivan Illarionov <ivan.illario... at gmail.com> wrote:
>>
>> > IMO .ini-like config files are from the stone age. The modern
>> > approach is to use YAML (http://www.yaml.org).
>>
>> You mean YAML isn't a joke!? It's so ludicrously overcomplicated, and
>> so comprehensively and completely fails to achieve its stated main goal
>> of being "readable by humans", that I had assumed it was an April Fool
>> along the lines of Intercal or brainf***.
>
>
> YAML, ISTM, took a simple concept that worked for small, straightforward
> data, and tried to make into a format that could anything anywhere, with
> disastrous results. It's not unlike Perl in this regard. It's quite
> ridiculous.
>
>
> My recommendation to the OP would be:
>
> If you intend to write a GUI that completely sets all the options, use
> XML. You can bet there are some users who would prefer text editing
> options files, and XML, while not the most readable format available, at
> least gives users the option.
>
> If you don't intend to write a GUI to do that, write a simple text file
> parser (if the options are simple), use ConfigParser, or use a Python
> file that you exec.
>
> Store the file in $HOME/.appname/config.ext on Unix, $USERDIR/
> ApplicationData/Appname/config.ext on Windows. I don't recommend using
> the Windows registry to store options; use it to modify Windows behavior
> (like file associations) but keep your own program's options in your own
> file.
>
>
> Carl Banks
If you don't like YAML, use JSON or something similar -- XML is overkill
and .INI is too limited.
--
Ivan
More information about the Python-list
mailing list