You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import tomlkit
doc = tomlkit.document()
def add_table(parent, name):
parent.add(name, tomlkit.table())
return parent[name]
root = add_table(doc, 'root')
first = add_table(root, "first")
print(">>> WITH A SINGLE TABLE:")
print(tomlkit.dumps(doc))
print()
second = add_table(root, "second")
print(">>> WITH A DOUBLE TABLE:")
print(tomlkit.dumps(doc))
You get:
>>> WITH A SINGLE TABLE:
[root.first]
>>> WITH A DOUBLE TABLE:
[root]
[root.first]
[root.second]
Notice that in the second example, we get an empty [root] table, whereas in the first case we do not. In both cases, I would not expect the table to be shown (and perhaps, none of the tables should be shown...).
Is this behaviour expected, and the intended behaviour of tomlkit
Is there a way to define a table which should not be shown if it remains empty?
The text was updated successfully, but these errors were encountered:
With the following code and
tomlkit 0.13
:You get:
Notice that in the second example, we get an empty
[root]
table, whereas in the first case we do not. In both cases, I would not expect the table to be shown (and perhaps, none of the tables should be shown...).The text was updated successfully, but these errors were encountered: