[Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

Glenn Linderman v+python at g.nevcal.com
Wed Apr 25 01:19:12 EDT 2018


On 4/24/2018 8:56 PM, Tim Peters wrote:
>   The alternative is typing the
> sub-expression(s) of interest by hand at the debugger prompt, or
> adding print()s, both of which are prone to introducing typos, or
> changing results radically due to triggering side effects in the code
> invoked by the duplicated sub-expression(s).  Adding a binding
> construct wouldn't change anything about how the code worked (apart
> from possibly clobbering a local name).
I've done both subexpression mangling (attempts at duplication) and 
added print statements and experienced these negative side effects, 
taking twice as long (or more) as intended to get the debugging 
information needed.

While I'm no core developer, and would have a mild appreciation of 
avoiding those while True: loops so was generally in favor of this PEP, 
but not enough to be inpsired to speak up about it, I would frequently 
benefit from this capability... adding extra binding names, and printing 
_them_ instead of the duplicated subexpressions.

+1

Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180424/06eec2d5/attachment-0001.html>


More information about the Python-Dev mailing list