space/tab conversion utility?

Martin Bless mb at
Thu Jul 29 07:40:56 CEST 2004

[Tim Peters <tim.peters at>:]

> is in your Python distribution, and is the state of the
>art for "intelligent" conversion of tab-infected files to
>space-celebrating ones.

I'm carrying a question around for quite a while now and it seems to
fit into this context. The issue is "configuration files".

I'm not really happy with "configparser" for some reasons and would
much more use python code itself as the natural und preferred way to
write configuration data. 

The idea is to read the configuration file, which should be Python
code, and accept only statements that can't be harmful. A grammar
somehow like this (as a sketch, written before breakfast):

value := "string constant" | "num constant" | ...
seq := (value*) | [value*]
assignment := name = seq | value
... and so on. To be elaborated.

In words: have assignments in the config file and accept only values
and structures that can do no harm. I'm not familiar with tokenizing
and python source code parsing yet.

My question:

Do you think I could accomplished this using standard Python means?
I'm thinking of the tokenize module, which I haven't used yet.

Will it be possible / easy / difficult?


More information about the Python-list mailing list