From 58b838a80bfe1d3307e730c293ce91cb93b332c9 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 2 Dec 2018 22:40:43 +0200 Subject: Can specify keyword arguments with a dict. --- docs/markdown/snippets/kwargdict.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 docs/markdown/snippets/kwargdict.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/kwargdict.md b/docs/markdown/snippets/kwargdict.md new file mode 100644 index 0000000..47c54d5 --- /dev/null +++ b/docs/markdown/snippets/kwargdict.md @@ -0,0 +1,28 @@ +## Can specify keyword arguments with a dictionary + +You can now specify keyword arguments for any function and method call +with the `kwargs` keyword argument. This is perhaps best described +with an example. + +```meson +options = {'include_directories': include_directories('inc')} + +... + +executable(... + kwargs: options) +``` + +The above code is identical to this: + +```meson +executable(... + include_directories: include_directories('inc')) +``` + +That is, Mesn will expand the dictionary given to `kwargs` as if the +entries in it had been given as keyword arguments directly. + +Note that any individual argument can be specified either directly or +with the `kwarg`` dict but not both. If a key is specified twice, it +is a hard error. -- cgit v1.1