Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197507

Re: Seeing Variables

From ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups comp.lang.python
Subject Re: Seeing Variables
Date 2025-06-12 08:59 +0000
Organization Stefan Ram
Message-ID <trace-20250612095734@ram.dialup.fu-berlin.de> (permalink)
References <names-20250611113016@ram.dialup.fu-berlin.de>

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>But how to achieve the same for local variables?

import pdb

def f():
    a = 1
    pdb.set_trace()

f()

  . Now, the program stops there and you can enter:

print( a )    (user input)
1             (system output)

  . However, it's a bit more difficult than it could be -
  especially for beginners - due to the cryptic names chosen!
  One could more easily remember something like:

import debug

def f():
    a = 1
    debug.stop()

f()

  . When a method is named "set_trace", some people might think
  its purpose is to set a property called "trace". Moreover, it's
  not obvious how invoking an interactive debug session should bring 
  up the idea of "setting a trace", what does that even mean??

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Seeing Variables ram@zedat.fu-berlin.de (Stefan Ram) - 2025-06-11 10:30 +0000
  Re: Seeing Variables ram@zedat.fu-berlin.de (Stefan Ram) - 2025-06-12 08:59 +0000
    Re: Seeing Variables Paul Rubin <no.email@nospam.invalid> - 2025-06-12 02:35 -0700

csiph-web