# \#dict

**URL:** https://discourse.julialang.org/tag/dict/941.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [In ComplexityMeasures.jl, is there a way to use elements of an OutcomeSpace as keys for Probabilities?](https://discourse.julialang.org/t/in-complexitymeasures-jl-is-there-a-way-to-use-elements-of-an-outcomespace-as-keys-for-probabilities/132038)

<div class="topic-metadata">

**Author:** [@mikhael](https://discourse.julialang.org/u/mikhael)\
**Replies:** 0\
**Last updated:** [September 1, 2025, 9:57pm UTC](https://discourse.julialang.org/t/in-complexitymeasures-jl-is-there-a-way-to-use-elements-of-an-outcomespace-as-keys-for-probabilities/132038 "2025-09-01T21:57:09Z")

</div>

Suppose I build a Probabilities object Prs from a vector x like so: using ComplexityMeasures x = rand(\[true, false\], 10) Prs, outs = allprobabilities\_and\_outcomes(UniqueElements(), x) I would like to have a Dict-like…

---

## [How to initialize a \`Dict\` with \`#undef\` content?](https://discourse.julialang.org/t/how-to-initialize-a-dict-with-undef-content/125154)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 6\
**Last updated:** [January 26, 2025, 1:10pm UTC](https://discourse.julialang.org/t/how-to-initialize-a-dict-with-undef-content/125154 "2025-01-26T13:10:28Z")

</div>

I want to initialize a Dict comprised of some #undef values. How can I do this? I tried Dict{String, Float64}(undef, 3) but it throws the following error: ERROR: MethodError: no method matching Dict{String, Float64}(::…

---

## [Dict of NamedTuple](https://discourse.julialang.org/t/dict-of-namedtuple/112836)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 4\
**Last updated:** [April 11, 2024, 5:34pm UTC](https://discourse.julialang.org/t/dict-of-namedtuple/112836 "2024-04-11T17:34:56Z")

</div>

Hello ! :grinning: I have a question about a behavior I don’t understand when I try to make a dictionary composed of NamedTuple. Each of these NamedTuple corresponds to a parameter set of a simulation. For example: ju…

---

## [Select a dictionary in a vector based on a specific entry value](https://discourse.julialang.org/t/select-a-dictionary-in-a-vector-based-on-a-specific-entry-value/109876)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 4\
**Last updated:** [February 9, 2024, 2:48pm UTC](https://discourse.julialang.org/t/select-a-dictionary-in-a-vector-based-on-a-specific-entry-value/109876 "2024-02-09T14:48:54Z")

</div>

Hi everyone, I’m looking for an easy way to filter/select dict in vector based on the value of one of the key. In the example below, I need to find the title of a data, given by the first Dict of the vector (but it is …

---

## [Is it safe to pop! a Dict in a loop like this?](https://discourse.julialang.org/t/is-it-safe-to-pop-a-dict-in-a-loop-like-this/108441)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 15\
**Last updated:** [January 7, 2024, 9:47pm UTC](https://discourse.julialang.org/t/is-it-safe-to-pop-a-dict-in-a-loop-like-this/108441 "2024-01-07T21:47:43Z")

</div>

At the moment, the following code gives the result that I want (i.e. the for loop goes through each key in the dict once): let mydict = Dict(\[i =\> rand() for i in 1:10\]) println(mydict) for k in keys(mydict) …

---

## [How to use \`TOML.print\` to print a \`Dict\` with keys as different \`MyStruct\` objects?](https://discourse.julialang.org/t/how-to-use-toml-print-to-print-a-dict-with-keys-as-different-mystruct-objects/100804)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 3\
**Last updated:** [June 25, 2023, 10:41pm UTC](https://discourse.julialang.org/t/how-to-use-toml-print-to-print-a-dict-with-keys-as-different-mystruct-objects/100804 "2023-06-25T22:41:49Z")

</div>

I’m currently working with a dictionary whose keys are instances of a custom struct named MyStruct. Here is the definition: struct MyStruct a::Int b::String end I need to use the TOML.print function to print th…

---

## [Creating a custom Dict clone for formatted printing?](https://discourse.julialang.org/t/creating-a-custom-dict-clone-for-formatted-printing/92975)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 2\
**Last updated:** [January 19, 2023, 11:54pm UTC](https://discourse.julialang.org/t/creating-a-custom-dict-clone-for-formatted-printing/92975 "2023-01-19T23:54:27Z")

</div>

I want to be able to print the key-value pairs from a Dict-like object in a certain formatted way. I see two ways to do this: Either write a my\_print(dct::Dict) function that does this and use a regular Dict to store th…
