Nested Dict woes - how to add multiple values to a key

    Jun 23 2021 | 8:01 am
    Hi. I'm having issues and confusions working with dict.
    I'm reading in a folder of tagged samples, which are labelled with pitch, articulation etc. I'm then creating a nested dict which I will later query (this is for managing transposition for notes which aren't sampled).
    I have a relatively simple problem which I'm struggling to address. I can add a nested dict using the replace message, which creates the following dict: "Instrument" : { "VLN" : { "ord" : [ 60 ] // (N.B this denotes pitch class) }
    I now want to add another value to Instrument / VLN / ord, so that the ord entry appears like this:
    "ord" : [ 60 , 72]
    However, using the replace message overwrites the initial value of "ord". I can use append to add this correctly, however, using append won't create the nested dict in the first place (I need to use replace). Therefore, it appears I need to find a way to ask dict if it has created the nested structure, and then if it hasn't add in some logic that decides whether the message is append or replace. However, I can't see anything in the documentation that shows how to ask dict whether it has a value for a certain key (i.e. for example returning a 1 or a 0). I'm sure this must be possible, though! Any help would be much appreciated.
    (MINOR RANT ALERT): As an aside, I remember people have been complaining about the documentation for dict for years. Nested dicts still only get one really small - quite obfuscated - example in the help tab. Are there any plans to expand it, or resources to work around this?

    • Jun 25 2021 | 12:12 pm
      contains Instrument::VLN::ord
    • Jun 25 2021 | 1:12 pm
      Hi Tyler - thanks that's exactly what I was looking for. Right clicking on the inlet I see it now as an option. Thanks again.