At 07:47 PM 1/28/2010 +0100, Benjamin Schweizer wrote:
Hello pje,

On Thu, Jan 28, 2010 at 12:43:13PM -0500, P.J. Eby wrote:
> At 11:01 AM 1/28/2010 -0600, s...@pobox.com wrote:
>
>> pje> If you look for a local variable in each frame containing a format >> pje> string, let's say __trace__, you could apply that format string to >> pje> a locals+globals dictionary for the frame, in place of dumping all
>>     pje> the locals by default....
>>

I like the idea of configuring the list of variables with using a
convention like __trace__, though this requires me to specify what
variables cause an exception and that would be hard?

The idea is that you simply use __trace__ to format the local variables for that frame. In other words, the programmer specifies what they want to see at that point in the traceback, by setting a variable in their code. If there's a __trace__ variable in the frame locals at that point in the traceback, simply format the traceback locals+globals using that string's .safe_format() method.


May be we could add a loglevel or something; or we keep it simple as it
is now but respect __trace__ if it is there.

Right - I'm saying, if there's a __trace__, you would just use that, and otherwise either include local variables or not, depending on whether they were requested in the traceback formatting call.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to