Runtime v2.81 · Updated Sep 30, 2026

dict

A key/value collection that keeps insertion order and can be read or updated during script execution.

Syntax

dict(mapping_or_pairs=(), /, **items)

Parameters

None

Returns

dict

Behavior / side effects

A key/value collection that keeps insertion order and can be read or updated during script execution.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = dict(mode="farm", retries=3)
mode = settings.get("mode")   # returns farm
keys = settings.keys()

for key in settings:
    text(str(settings[key]))   # returns None

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

None

Methods

17 methods

dict.constructor

Create an empty dictionary, copy a mapping or iterable of pairs, or build entries from keyword arguments.

Syntax

dict()
dict(mapping_or_pairs, /)
dict(key=value, ...)

Parameters

NameDescription
mapping_or_pairsdict | Iterable
Mapping or iterable of two-item pairs to copy.
Depends on overload · Positional only
Default: None
key=valueAny?
Keyword entries to add after the source mapping.
Optional · Variadic
No default

Returns

dict — A new mutable dictionary.

Behavior / side effects

Create an empty dictionary, copy a mapping or iterable of pairs, or build entries from keyword arguments.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = dict(mode="farm", retries=3)
copied = dict(settings)
from_pairs = dict([("mode", "pvp")])

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.literal

Create a dictionary with string, number, boolean, or object values.

Syntax

{"mode": "farm", "retries": 3}

Parameters

NameDescription
keyString
dict key.
Required · Positional or named
No default
valueAny?
Value stored for that key.
Required · Positional or named
No default

Returns

dict — A new dictionary that preserves the literal entry order.

Behavior / side effects

Create a dictionary with string, number, boolean, or object values.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {
    "mode": "farm",
    "retries": 3,
    "enabled": True
}

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.comprehension

Build a dictionary from an iterable while preserving insertion order.

Syntax

{key: value for target in iterable if condition}

Parameters

NameDescription
keyAny
dict key calculated for each accepted item.
Required · Positional or named
No default
valueAny?
Value stored for that key.
Required · Positional or named
No default
targetName | destructuring target
Loop target for the current item. Starred targets are not supported.
Required · Positional or named
No default
iterableIterable
Source values to loop through.
Required · Positional or named
No default
conditionBoolean
Optional filter checked before storing an entry.
Optional · Positional only
Default: True

Returns

dict — A new mutable dictionary.

Behavior / side effects

Build a dictionary from an iterable while preserving insertion order. Multiple for/if clauses are supported.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

pairs = [("mode", "farm"), ("retries", 3)]
settings = {key: value for key, value in pairs}

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.key_access

Read one value by key.

Syntax

dictionary["key"]

Parameters

NameDescription
dictionarydict
The source dictionary.
Required · Positional or named
No default
keyAny
Key to look up.
Required · Positional or named
No default

Returns

Any? — The stored value for that key, or None when the key is absent.

Behavior / side effects

Read one value by key. Missing keys return None.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
mode = settings["mode"]        # returns farm
missing = settings["unknown"]  # returns None

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.key_assignment

Write or replace one key/value entry with bracket assignment syntax.

Syntax

dictionary[key] = value

Parameters

NameDescription
dictionarydict
The mutable dictionary to update.
Required · Positional or named
No default
keyAny
Key to write or replace.
Required · Positional only
No default
valueAny?
Value to store for that key.
Required · Positional only
No default

Returns

None — No direct return value. The dictionary is updated in place.

Behavior / side effects

Write or replace one key/value entry with bracket assignment syntax.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm"}
settings["mode"] = "pvp

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.length

Count how many key/value pairs are in the dictionary.

Syntax

len(dictionary, /)

Parameters

NameDescription
dictionarydict
The dictionary to count.
Required · Positional only
No default

Returns

Int — Number of entries in the dictionary.

Behavior / side effects

Count how many key/value pairs are in the dictionary.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
count = len(settings)          # returns 2

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.get_method

Read a value by key and optionally fall back to a default.

Syntax

dictionary.get(key, default=None, /)

Parameters

NameDescription
keyAny
Key to look up.
Required · Positional only
No default
defaultAny?
Fallback value returned when the key is missing.
Optional · Positional only
Default: None

Returns

Any? — The stored value for that key, or the provided default.

Behavior / side effects

Read a value by key and optionally fall back to a default.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm"}
mode = settings.get("mode")           # returns farm
retry = settings.get("retries", 0)    # returns 0

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.items_method

Get key/value pairs as a list of two-item tuples in insertion order.

Syntax

dictionary.items()

Parameters

None

Returns

list — A list of (key, value) tuples.

Behavior / side effects

Get key/value pairs as a list of two-item tuples in insertion order.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm"}
pairs = settings.items()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.pop_method

Remove one key and return its value, or return the default when missing.

Syntax

dictionary.pop(key, default=None, /)

Parameters

NameDescription
keyAny
Key to remove.
Required · Positional only
No default
defaultAny?
Fallback returned when the key is missing.
Optional · Positional only
Default: None

Returns

Any? — Removed value or fallback default.

Behavior / side effects

Remove one key and return its value, or return the default when missing.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
removed = settings.pop("retries")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.copy_method

Copy the dictionary into a new mutable dictionary.

Syntax

dictionary.copy()

Parameters

None

Returns

dict — A new dictionary with the same entries.

Behavior / side effects

Copy the dictionary into a new mutable dictionary.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm"}
copied = settings.copy()

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.update_method

Update this dictionary from another mapping, pairs iterable, and keyword entries.

Syntax

dictionary.update(other=(), /, **items)

Parameters

NameDescription
otherdict | Iterable
Mapping or pairs to merge.
Optional · Positional only
Default: None
itemsAny?
Keyword entries to write.
Optional · Variadic
No default

Returns

None — No direct return value. The dictionary is updated in place.

Behavior / side effects

Update this dictionary from another mapping, pairs iterable, and keyword entries.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm"}
settings.update([("retries", 3)], mode="pvp")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.setdefault_method

Return an existing value, or store and return the default when the key is missing.

Syntax

dictionary.setdefault(key, default=None, /)

Parameters

NameDescription
keyAny
Key to read or create.
Required · Positional only
No default
defaultAny?
Value stored when the key is absent.
Optional · Positional only
Default: None

Returns

Any? — Existing value or inserted default.

Behavior / side effects

Return an existing value, or store and return the default when the key is missing.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = dict()
mode = settings.setdefault("mode", "farm")

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.keys_method

Get the dictionary keys as a list in insertion order.

Syntax

dictionary.keys()

Parameters

None

Returns

list — A list of keys.

Behavior / side effects

Get the dictionary keys as a list in insertion order.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
keys = settings.keys()
first_key = keys[0]                 # returns mode

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.values_method

Get the dictionary values as a list in insertion order.

Syntax

dictionary.values()

Parameters

None

Returns

list — A list of values.

Behavior / side effects

Get the dictionary values as a list in insertion order.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
values = settings.values()
last_value = values[-1]             # returns 3

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.clear_method

Remove every key/value pair from the dictionary.

Syntax

dictionary.clear()

Parameters

None

Returns

None — No direct return value. The dictionary becomes empty.

Behavior / side effects

Remove every key/value pair from the dictionary.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
settings.clear()
text(str(len(settings)))   # returns 0

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.for_loop

Loop through dictionary keys in the same order they were written in the literal.

Syntax

for key in dictionary:

Parameters

NameDescription
keyAny
Current key inside the loop.
Required · Positional or named
No default
dictionarydict
The dictionary to iterate.
Required · Positional or named
No default

Returns

None — No direct return value. The loop runs once per key.

Behavior / side effects

Loop through dictionary keys in the same order they were written in the literal.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {"mode": "farm", "retries": 3}
for key in settings:
    text(str(settings[key]))   # returns None

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs

dict.truthy_check

Check whether the dictionary has at least one entry.

Syntax

if dictionary | if not dictionary

Parameters

NameDescription
dictionarydict
The dictionary used in the condition.
Required · Positional or named
No default

Returns

Boolean condition — true when the dictionary is not empty, false when it is empty.

Behavior / side effects

Check whether the dictionary has at least one entry. An empty dictionary is treated as false.

Execution

  • Blocking: No
  • Thread safety: Use separate objects per flow
  • Parallel execution: Yes

Value operations execute in the calling flow without an intentional wait for capture, gesture completion, or user input. Create mutable containers/builders separately in each flow; this is isolation, not a shared-object synchronization guarantee.

Example

settings = {}
if not settings:
    text("No settings")       # returns None

Errors / limitations

No additional limitations documented; follow the parameter and behavior contract above.

Related APIs