From 24cdd631a048a479e0d585233892139787c16044 Mon Sep 17 00:00:00 2001 From: fuzzyman Date: Mon, 1 Mar 2010 23:32:10 +0000 Subject: Doc changes. --- docs/configobj.txt | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'docs') diff --git a/docs/configobj.txt b/docs/configobj.txt index f86246d..334ec8b 100644 --- a/docs/configobj.txt +++ b/docs/configobj.txt @@ -2034,6 +2034,13 @@ which discards comments. String Interpolation ==================== +.. note:: + + String interpolation can slow down (slightly) the fetching of values + from your config object. If you aren't using interpolation and it + is performance critical then create your instance with + ``interpolation=False``. + ConfigObj allows string interpolation *similar* to the way ``ConfigParser`` or ``string.Template`` work. The value of the ``interpolation`` attribute determines which style of interpolation you want to use. Valid values are @@ -2090,6 +2097,30 @@ New in ConfigObj 4.7.0: String interpolation is now done in members of list values. +String Interpolation and List Values +------------------------------------ + +Since version 4.7 string interpolation is done on string members of list values. +If interpolation changes any members of the list then what you get back is a +*copy* of the list rather than the original list. + +This makes fetching list values slightly slower when interpolation is on, it +also means that if you mutate the list changes won't be reflected in the +original list: + +.. code-block:: python + + >>> c = ConfigObj() + >>> c['foo'] = 'boo' + >>> c['bar'] = ['%(foo)s'] + >>> c['bar'] + ['boo'] + >>> c['bar'].append('fish') + >>> c['bar'] + ['boo'] + +Instead of mutating the list you must create a new list and reassign it. + Comments ======== -- cgit v1.2.1