> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/larky/library-api/dicts.md).

# dicts

Starlark module for working with dicts.

## dicts.add(\*dictionaries, \*\*kwargs)

Returns a new dict that has all the entries of the given dictionaries.

If the same key is present in more than one of the input dictionaries, the last of them in the argument list overrides any earlier ones. If you want to be alerted when there is an override see dicts.unique\_add.

This function is designed to take zero or one arguments as well as multiple dictionaries, so that it follows arithmetic identities and callers can avoid special cases for their inputs: the sum of zero dictionaries is the empty dictionary, and the sum of a single dictionary is a copy of itself.

Example:

```python
dicts.add({'language': 'larky', 'company': 'vgs'}, {'version': '0.1.0'})
{'language': 'larky', 'company': 'vgs', 'version': '0.1.0'}
```

**Parameters:**

* \***dictionaries** - zero or more dictionaries to be added.
* \*\***kwargs** - additional dictionary passed as keyword args.

**Returns:** a new dict that has all the entries of the given dictionaries.

## dicts.only(dictionary, \*keys)

*Returns:* a new dict that only has the keys you specified.

Example:

```python
dicts.only({'language': 'larky', 'company': 'vgs', 'version': '0.1.0'}, 'company', 'version')
{'company': 'vgs', 'version': '0.1.0'}
```

**Parameters:**

* **dictionary** - the dictionary to operate on.
* \***keys** – the keys in the dictionary you want to keep.

*Returns:* a new dict that only has the keys you specified.

## dicts.unique\_add(\*dictionaries, \*\*kwargs)

Like dicts.add but fails when there is a duplicate key.

**Parameters:**

* \***dictionaries** - zero or more dictionaries to be added.
* \*\***kwargs** - additional dictionary passed as keyword args.

*Returns:* a new dict that has all the entries of the given dictionaries.

## dicts.without(dictionary, \*keys)

*Returns:* a new dict that has all the keys except the ones you specified.

Example:

```python
dicts.without({'language': 'larky', 'company': 'vgs', 'version': '0.1.0'}, 'version', 'company')
{'language': 'larky'}
```

**Parameters:**

* **dictionary** - the dictionary to operate on.
* \***keys** - the keys in the dictionary you want removed.

*Returns:* a new dict that has all the keys except the ones you specified.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/larky/library-api/dicts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
