Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #436: Daemon escaped from pentagram


comp / comp.lang.python / TOML and Python

SubjectAuthor
* TOML and PythonStefan Ram
`- Re: TOML and Python (Posting On Python-List Prohibited)Lawrence D'Oliveiro

1
Subject: TOML and Python
From: Stefan Ram
Newsgroups: comp.lang.python
Organization: Stefan Ram
Date: Sat, 6 Jul 2024 13:42 UTC
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: TOML and Python
Date: 6 Jul 2024 13:42:48 GMT
Organization: Stefan Ram
Lines: 67
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <TOML-20240706144158@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de kPi/TxoeEfNKXEk0wSk90Aj1JXgaEEU3yAmv8fET3Ju0IO
Cancel-Lock: sha1:k2p584R9wjvbWYlCI/o9o7iARM0= sha256:QGVxv2/48Z818c3d4hWSKajFWwOjs8iPc+gEzE3e6dw=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
View all headers

A structure with information can be represented in TOML,
see example [1]. However, equivalent information also could
be written in pure Python and possibly be parsed with ast.
literal_eval, see example [2].

Since we already have Python, why do we need TOML in
addition?

What advantages do you see in using TOML for ini or config
files instead of Python?

When is it better to use TOML and when is it better to user
Python to represent structured information?

TIA!

[1]

# This is a TOML document

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00

[database]
server = "192.168.1.1"
ports = [ 8000, 8001, 8002 ]
connection_max = 5000
enabled = true

[servers]

[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"

[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"

[2]

config = {
"title": "TOML Example",
"owner": {
"name": "Tom Preston-Werner",
"dob": "1979-05-27T07:32:00-08:00"
},
"database": {
"server": "192.168.1.1",
"ports": [8000, 8001, 8002],
"connection_max": 5000,
"enabled": True
},
"servers": {
"alpha": {
"ip": "10.0.0.1",
"dc": "eqdc10"
},
"beta": {
"ip": "10.0.0.2",
"dc": "eqdc10"
}
}
}

Subject: Re: TOML and Python (Posting On Python-List Prohibited)
From: Lawrence D'Oliv
Newsgroups: comp.lang.python
Organization: A noiseless patient Spider
Date: Sun, 7 Jul 2024 03:51 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.python
Subject: Re: TOML and Python (Posting On Python-List Prohibited)
Date: Sun, 7 Jul 2024 03:51:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <v6d3b5$6dlv$4@dont-email.me>
References: <TOML-20240706144158@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 07 Jul 2024 05:51:02 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="68b1498c9728a898ae95fa9c50f05ec1";
logging-data="210623"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181oX8RWNHrbqr/cHLStHkJ"
User-Agent: Pan/0.158 (Avdiivka; )
Cancel-Lock: sha1:T7BJ17U/h6g8ddmd94lsozRCOUc=
View all headers

On 6 Jul 2024 13:42:48 GMT, Stefan Ram wrote:

> Since we already have Python, why do we need TOML in addition?

TOML isn’t Python-specific.

1

rocksolid light 0.9.8
clearnet tor