Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread C Anthony Risinger
On Thu, Jan 25, 2018 at 5:09 PM, Nick Timkovich wrote: > I think part of the reason that logging appears complicated is because > logging actually is complicated. In the myriad different contexts a Python > program runs (daemon, command line tool, interactively), the

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Nick Timkovich
I think part of the reason that logging appears complicated is because logging actually is complicated. In the myriad different contexts a Python program runs (daemon, command line tool, interactively), the logging output should be going to all sorts of different places. Thus was born handlers. If

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Joseph Jevnik
This can be accomplished as a decorator. Jim Crist wrote a version of this using the codetransformer library. The usage is pretty simple: @trace() def sum_word_lengths(words): total = 0 for w in words: word_length = len(w) total += word_length return total >>>

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Greg Ewing
Steve Barnes wrote: I would suggest, however, that if this feature is introduced it be controlled via a run-time switch &/or environment variable which defaults to off. I disagreew with defaulting it to off. That would encourage lazy developers to distribute library code full of #l lines, so

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Oleg Broytman
On Thu, Jan 25, 2018 at 11:44:55AM +0100, St??fane Fermigier wrote: > 1. I too dislikes the idea of using comments as semantically significant > annotations. > > I think it's quite OK for annotation that are aimed at external tools (e.g. > '# nocover' or '# noqa') but not

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Chris Barker - NOAA Federal
This strikes me as something a debugger should do, rather than the regular interpreter. And using comment-based syntax means that they would get ignored by the regular interpreter— which is exactly what you want. As for a decoration approach— that wouldn’t let you do anything on a line by line

Re: [Python-ideas] Non-intrusive debug logging

2018-01-25 Thread Stéfane Fermigier
Some thoughts: 1. I too dislikes the idea of using comments as semantically significant annotations. I think it's quite OK for annotation that are aimed at external tools (e.g. '# nocover' or '# noqa') but not for runtime behavior. 2. It's probably possible do do interesting things using

Re: [Python-ideas] Non-intrusive debug logging

2018-01-24 Thread Steve Barnes
On 24/01/2018 23:25, Larry Yaeger wrote: > Everyone uses logging during code development to help in debugging. Whether > using a logging module or plain old print statements, this usually requires > introducing one or (many) more lines of code into the model being worked on, > making the

[Python-ideas] Non-intrusive debug logging

2018-01-24 Thread Larry Yaeger
Everyone uses logging during code development to help in debugging. Whether using a logging module or plain old print statements, this usually requires introducing one or (many) more lines of code into the model being worked on, making the existing, functional code more difficult to read. It