jeudi 16 avril 2020

Correct deign pattern for multiple defines in python directory?

As my project grew big, I have multiple paths that I point all over the project, for example, paths and dictionary key names.

So currently I have

./file1.py
WIKI_TO_ML_DICT_PATH = '...'
CATEGORIES_KEY = 'categories'
...
...

./subdir/file2.py
WIKI_TO_ML_DICT_PATH = '...'
CATEGORIES_KEY = 'categories'
...
...

And I, of course, want them all to point to the same defines. What is the correct way to do that in terms of design and readability? Create a class with no functions in the root dir and import it from all?

Thanks.

Aucun commentaire:

Enregistrer un commentaire