On Sun, Jul 28, 2019 at 01:19:38AM -0400, James Lu wrote:
> Minimal strawman proposal. New keyword debug.
>
> debug EXPRESSION
>
> 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.
> debug context
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())
--
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/GP3EAWBC6QCXONPLP53RTYRRI2HNVKTJ/
Code of Conduct: http://python.org/psf/codeofconduct/