On Sun, Jul 28, 2019 at 01:19:38AM -0400, James Lu wrote:
Minimal strawman proposal. New keyword debug.
Executes EXPRESSION when in debug mode.
That's what assert does, in part. Since print is now a function, not a statement, you can do this:
assert print(expression) or True
to get the same effect.
So "context" is also going to be keyword? That's two new keywords, breaking twice as much existing code: anything that uses "debug", anything that uses "context".
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())