ConfigParser & dots

BSD UNIX bsdunix at bellatlantic.net
Wed Oct 4 00:01:09 EDT 2000


Hello all.

I'm still getting acquainted to Python, and a little thing I'm working on
was going to use fully qualified domain names as sections in a config file,
something like:

[somehost.example.dom]
setting = value

The problem I run into is that dots are not allowed in section headers (from
ConfigParser.py, line 240):

# Regular expressions for parsing section headers and options.  Note a
# slight semantic change from the previous version, because of the use
# of \w, _ is allowed in section header names.
    __SECTCRE = re.compile(
        r'\['                                 # [
        r'(?P<header>[-\w]+)'                 # `-', `_' or any alphanum
        r'\]'                                 # ]
        )

Yet the options can contain dots.

This is using v1.5.2, however.  Is this going to be changed (or is it
already)?  What is the reasoning behind disallowing dots in the section
headers?

Thanks in advance,

Bill
bsdunix at bellatlantic.net






More information about the Python-list mailing list