Do we really need to add every color to locals()?
See original GitHub issueCurrently, constants.py is adding every color inside COLOR_MAP to the locals() dictionary. This is usually frowned upon in Python in general.
If we want to keep exposing all colors to the end user without any namespace access (like manim.colors.RED or some such), then we can carefully import all colors inside __init__.py. This could be done for the purpose of backward compatibility.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Why add key in locals actually create variable? - Stack Overflow
So something like locals()['a'] = 'hello' actually creates a new global variable a , and that's perfectly fine in Python, because global ...
Read more >Make Sense of Your Variables at a Glance with Semantic ...
PyCharm uses semantic highlighting to assign a different color to each parameter and local variable: the “namespaces” parameter is now a certain ...
Read more >Theming With Variables: Globals and Locals - CSS-Tricks
You 'll notice that we are defining locally-scoped variables with global variables. This is key for the system to work since it allows...
Read more >Python locals() - Finxter
Python's locals() function returns a dictionary of name --> object mappings. The names are the ones defined in the current local scope, i.e.,...
Read more >Locally Scoped CSS Variables: What, How, and ... - Una Kravets
We Can Do Better with Local Scope This is a great way to set global variables, but isn't a necessity. CSS variables don't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I still think we should move all colors to something like
manim.colors, and turn them all intoColourinstances too. We can easily do this in a backwards-compatible way.#488 implements this.