# HG changeset patch # User Franz Glasner # Date 1653909833 -7200 # Node ID 6102b767fc696e1a7a40fb63ca12e5e53e957665 # Parent 213f0ec3bbbc20074fc7813f1546c0f93aa5dd3a Basic documentation for the indexed list access diff -r 213f0ec3bbbc -r 6102b767fc69 docs/introduction.rst --- a/docs/introduction.rst Mon May 30 13:19:19 2022 +0200 +++ b/docs/introduction.rst Mon May 30 13:23:53 2022 +0200 @@ -290,6 +290,26 @@ :py:meth:`~.Configuration.getvarl_s` quoting is neither needed and not supported. + +Direct Access to List Items +--------------------------- + +Direct access to list items is possible: + +- Directly use the integer list index in :py:meth:`~.Configuration.getvarl` + and its friends. +- Encode the index number to string format using the ``~INDEX~`` syntax and + use :py:meth:`~.Configuration.getvar` and its friends. + +Negative indexes are supported with Python semantics. + +Examples: + +- ``config.getvarl_s("mylist", 0)`` or ``config.getvar_s("mylist.~0~)"`` +- ``config.getvarl_s("mylist", -1)`` or ``config.getvar_s("mylist.~-1~")`` + + + .. _merging-deletions: Deletions