Most Pythonic way to provide global configuration variables in config.py? [closed]

How about just using the built-in types like this: config = { “mysql”: { “user”: “root”, “pass”: “secret”, “tables”: { “users”: “tb_users” } # etc } } You’d access the values as follows: config[“mysql”][“tables”][“users”] If you are willing to sacrifice the potential to compute expressions inside your config tree, you could use YAML and end … Read more

Is it possible to use global variables in Rust?

It’s possible, but heap allocation is not allowed directly. Heap allocation is performed at runtime. Here are a few examples: static SOME_INT: i32 = 5; static SOME_STR: &’static str = “A static string”; static SOME_STRUCT: MyStruct = MyStruct { number: 10, string: “Some string”, }; static mut db: Option<sqlite::Connection> = None; fn main() { println!(“{}”, … Read more