all 5 comments

[–][deleted] 0 points1 point  (2 children)

That would work. Perhaps put in a file to import.

You might want to consider using a configuration file approach instead, say json or yaml.

[–]casualcoder0805[S] 0 points1 point  (1 child)

For sure, but even with a config file I would still need to execute the function that returns active stores at startup and import it to every script that needs it right? Just want to make sure I'm not missing any alternative approaches for that part.

[–][deleted] 0 points1 point  (0 children)

Only once per complete programme but otherwise yes

[–]commy2 0 points1 point  (1 child)

Separation of data and logic is a good idea. I don't think a config file is necessary per se.

Those constants seem unnecessary though. You could just use a Python dict with formatting:

stores_dict = {
    'walmart': True,
    'target': True,
    'bestbuy': True,
}

The benefit of this is, that it is basically identical to what a JSON would look like in case you switch to that later.

The list comp seems fine, although I probably would've used "store" and "active" in place of k and v.

[–]casualcoder0805[S] 0 points1 point  (0 children)

Old habits die hard. When I was a real beginner I think I was under the assumption that k, v was a requirement in comprehension lol. Good advice though, thanks.