Re: Seeing Variables

Liste des GroupesRevenir à cl python 
Sujet : Re: Seeing Variables
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.python
Date : 12. Jun 2025, 09:59:58
Autres entêtes
Organisation : Stefan Ram
Message-ID : <trace-20250612095734@ram.dialup.fu-berlin.de>
References : 1
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??



Date Sujet#  Auteur
11 Jun 25 * Seeing Variables3Stefan Ram
12 Jun 25 `* Re: Seeing Variables2Stefan Ram
12 Jun 25  `- Re: Seeing Variables1Paul Rubin

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal