Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managing global variables #11

Open
CarlinLiao opened this issue Feb 6, 2021 · 0 comments
Open

Managing global variables #11

CarlinLiao opened this issue Feb 6, 2021 · 0 comments
Assignees

Comments

@CarlinLiao
Copy link
Member

https://github.com/spartalab/aimsim/blob/56e9beaeb158b0c045f117e3b44f2c7421879659/aimsim/shared.py#L182-L183

From #2 (comment)

@ribsthakkar

should this be global? maybe you can pass an instance of the simulator around?

@CarlinLiao

From what I read, the way to share a single instance variable among multiple Python files is for them all to absolute import one module as an instance. Any updates to that instance is reflected across all modules.

@pyrito

I'd be careful with global variables in python, might be better off created a container for this kind of information potentially. Something like "GlobalState" and store a bunch of variables in this. It is more modular and makes life easier in the long run.

@CarlinLiao

I'd be careful with global variables in python, might be better off created a container for this kind of information potentially. Something like "GlobalState" and store a bunch of variables in this. It is more modular and makes life easier in the long run.

I think I kind of implemented this with the new Settings class in SHARED. Most but not all global settings are now contained in there... take a look and let me know if this is what you meant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants