[Python-ideas] Efficient debug logging

Barry Scott barry at barrys-emacs.org
Thu Feb 16 05:33:22 EST 2017


So if python converted:

	debugLog( <# ‘format string %r’ % (expensive(),) #> )

Into:

	def __tmp__():
		yield ‘format string %r’ % (expensive(),)

	debugLog( __tmp__ )

Then debugLog can detect the generator and call __next__ only if logging is enabled.

I guess at that point its the same as using the lambda but you have the syntax sugar
of Steven’s <# … #>.

Barry


> On 15 Feb 2017, at 16:46, Sven R. Kunze <srkunze at mail.de> wrote:
> 
> On 15.02.2017 12:55, Barry Scott wrote:
>> The lazy eval sound like a generator.
>> 
> 
> Exactly my thought.
> 
> 
> Sven
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 



More information about the Python-ideas mailing list