diff options
-rw-r--r-- | docs/configobj.txt | 31 | ||||
-rw-r--r-- | setup.py | 2 |
2 files changed, 32 insertions, 1 deletions
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 ======== @@ -16,7 +16,7 @@ NAME = 'configobj' MODULES = 'configobj', 'validate' -DESCRIPTION = 'Config file reading, writing, and validation.' +DESCRIPTION = 'Config file reading, writing and validation.' URL = 'http://www.voidspace.org.uk/python/configobj.html' |