# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
