Лучший/самый чистый способ определения списков констант или словарей [закрыто] ⇐ Python
-
Гость
Лучший/самый чистый способ определения списков констант или словарей [закрыто]
I'm having trouble creating something which would be synonymous to a C header file (.h).
I have medium sized dictionaries and lists (about 1,000 elements), lengthy enums, and '#defines' (well not really), but I can't find a CLEAN way to organize them all. In C, I would throw them all in a header file and never think again about it, however, in Python that's not possible or so I think.
Current dirty solution: I'm initializing all constant variables at the top of either the module or function (module if multiple functions need it).
How can I cleanly organize constant variables?
Источник: https://stackoverflow.com/questions/111 ... ctionaries
I'm having trouble creating something which would be synonymous to a C header file (.h).
I have medium sized dictionaries and lists (about 1,000 elements), lengthy enums, and '#defines' (well not really), but I can't find a CLEAN way to organize them all. In C, I would throw them all in a header file and never think again about it, however, in Python that's not possible or so I think.
Current dirty solution: I'm initializing all constant variables at the top of either the module or function (module if multiple functions need it).
How can I cleanly organize constant variables?
Источник: https://stackoverflow.com/questions/111 ... ctionaries