Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Is their a way to use None in toml files? #346

Closed
amaank404 opened this issue Jan 5, 2021 · 2 comments
Closed

Q: Is their a way to use None in toml files? #346

amaank404 opened this issue Jan 5, 2021 · 2 comments

Comments

@amaank404
Copy link

I was trying to add None to the file but it was not accepting any of these values None, none, null. so i just opened up a interpreter, constructed a dictionary {"s": {'r': None}} and when i used toml.dumps on it the section s contained no field named as r. which was initially set None.

Toml does not seem to raise error on invalid values.

If None is not implemented for now. This is feature request.

@eksortso
Copy link

eksortso commented Jan 5, 2021

@xcodz-dot I tried your sample dict on toml v0.10.2 in python 3.9.1, and got the same behavior. I think it's a bug.

As of the current TOML standard (v1.0.0rc3), there is no way to assign any kind of null as a value. This was a deliberate design choice. It reflects TOML's primary purpose as a configuration format, and not every type of data can be expressed in TOML, including null-like objects like Python's None.

Perhaps it needs to be discussed as an issue on the standard's project, especially if you want nulls to be allowed, post-v1.0.0. My own take is, nulls are currently invalid in TOML, and can't just be ignored by emitters. So any encoder that attempts to dump None ought to raise an error.

@amaank404
Copy link
Author

So I should close this for now. I will try about this in standards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants