Steven D'Aprano wrote:
By the way, you know that Python has a read-only global variable that tells you whether you are in debug mode? You can write a function to display anything you like, and wrap it in a test like this: if __debug__: display(locals())
Oh interesting, I wasn't aware of this global. For anyone else just finding out about it, here's the [documentation](https://docs.python.org/3.9/library/constants.html#__debug__). Thanks for mentioning it, I feel like I end up learning something new in almost every python-ideas and python-dev thread, even if the proposal from the author isn't accepted. I should've subscribed a while ago (:
Is there any other way to toggle/specify debug status other than the use of `-O`?