pyhocon
pyhocon copied to clipboard
Is += working at all?
test.conf:
foo {
baz = ["a"]
baz += "b"
}
code:
from pyhocon import ConfigFactory
spec = ConfigFactory.parse_file('./test.conf'))
print(spec)
output:
ConfigTree([('foo', ConfigTree([('baz', ' b')]))])
I thot += will concatenate...
Actually, it DOES concatenate... If you create the following config, the += would work... but NOT as intended:
x = [1, 2]
d {
x = [1,2]
x += [3,4]
}
Results in:
{
"x": [
1,
2
],
"d": {
"x": [
1,
2,
3,
4
]
}
}
Also, according to https://hocon-playground.herokuapp.com/, the += operator SHOULD NOT extend arrays, only append elements, which, ironically, pyhocon can't do.
thanks!