this post was submitted on 14 Jul 2023
6 points (100.0% liked)

Python

6368 readers
16 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

I have a use case where I'd like to store a handful of strings with static values, alongside my code that references them. The general reason for not hard coding them where they're called, is that I'd like to make it easy for the end user to customize and modify them.

Are there any suggestions or comments about the best ways to do this? Storing them in a python file as vars seems reasonable. I've also considered saving them as JSON, though I don't know if there's any benefit to that in this case.

Thoughts are appreciated.

you are viewing a single comment's thread
view the rest of the comments
[–] whRQla8GEMdqXW2OVCbS@lemmy.blahaj.zone 6 points 1 year ago (2 children)

I always use a yaml file for user config but json is fine, too

[–] l3mming@lemmy.fmhy.ml 2 points 1 year ago* (last edited 1 year ago) (1 children)

Yaml is pure evil with utterly useless syntax checking.

Ever tried maintaining a Swagger file using yaml?

I'm never touching that shit again.

[–] davenull@programming.dev 1 points 1 year ago

YAML is far from perfect but this seems like a hot take. I work with OpenAPI definitions a lot so I'm just curious what you found difficult about maintaining a definition in YAML?