Dict with key "1" conflicts with key 1 as integer: produces two keys


a dict with key as string "1", "2" "3" etc. conflicts with same key as integer:

Problem: it produces two keys with identical values/subkey values when i update an as string created key-value with a calculated integer key-value.
If i increase the integer-Keys value , the string-keys value is increased and vice versa.
I show this in my example as i increase the charlie subkey for the "1" only and the delta subkey for the int 1 only but both keys show both subkey-values increased.

The dict now has two Keys called "1" and 1 which show, when printing a copy of the dict to a label, both as "1" and when i iterate over the list of keys there is now a redundant key where only should be one of both.

The reason why i come over this problem is: I have to calculate the keyname in my non-test-application which is therefore an integer and this leads to this strange behavior.

Yes i know it could possible to concat the int to some other string but that did not work in my main app for unknown reasons also(investigation is undergoing), and the described problem seems important enough to me for reporting.

I have attached an aia
testwritedeepdict.aia (5.0 KB)
with a test app for reproducing and documenting every step of the problem.

Many thanks in advance


Hmmm, this is a tricky one :wink:

Can you simplify the dictionary content to work with just one set, get that working, then see how this can then be expanded to additional sets?

This may be more of a feature than a bug.

1 Like

How could it be a feature if i increase the value of subkey charlie of key string "1" it also increases the subkey charlie of subkey int 1?

testwritedeepdict_small.aia (4.1 KB)

This is the reduced program where also the report is more detailed to describe how the expected result differs from the actual result.

Ok I guess i understand now fully whats happening.

string 1 and int 1 are aliases for the same key and therefore referencing the same subdict with its keys.

So all are getting updated.
So far so good.

But when i loop/iterate over the list of keys. How can i remove or even recognize the aliases?

And if you look at the example at first i operate only on string "1"
but then i operate only at int 1 which includes at first a read operation to int 1 which does not exist at this moment so it seem to get the value from key string "1".
so here is: key int 1 = key string 1

Then i increase the value und write the result to key int 1 which not exists and so results in a new alias key int 1.
so here was key int 1 != key string 1

It could be by design but somewhat suprising.

So theres is at least the already mentioned problem:
When i loop/iterate over the list of keys - how can i remove or even recognize the aliases?
Some dedicated datatype conversion would also help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.