This behaviour is noted in the Wiki, but I don't agree it is as it should be.
Using default_box, one can create and modify a new dotted chain as expected:
>>> b=Box(default_box=True)
>>> b.a.b.c = 1
>>> print(b)
<Box: {'a': {'b': {'c': 1}}}>
>>> b["a.b.c"] = 2
>>> print(b)
<Box: {'a': {'b': {'c': 2}}}>
However, when trying to create a new value using box_dots, it does not work as I expect (again the demonstrated behavior is noted in the Wiki).
>>> b=Box(default_box=True, box_dots=True)
>>> b["a.b.c"] = 1
>>> print(b)
<Box: {'a.b.c': 1}>
By declaring box_dots=True the programmer has explicitly stated they want to interpret the periods as field separators. It seems that the above code should return the same as the first code block.
Since I require this behavior, I have to split the index string and create empty boxes, then perform the b["a.b.c"]=1 for it to work as intended.
This behaviour is noted in the Wiki, but I don't agree it is as it should be.
Using default_box, one can create and modify a new dotted chain as expected:
However, when trying to create a new value using box_dots, it does not work as I expect (again the demonstrated behavior is noted in the Wiki).
By declaring box_dots=True the programmer has explicitly stated they want to interpret the periods as field separators. It seems that the above code should return the same as the first code block.
Since I require this behavior, I have to split the index string and create empty boxes, then perform the
b["a.b.c"]=1for it to work as intended.