Message257888
Consider the following example:
def f(x=1):
def g():
y = 2
raise Exception
g()
f()
$ python -mpdb -ccontinue example.py
<... traceback ...>
> /tmp/example.py(4)g()
-> raise Exception
(Pdb) p x
##### this can be worked around using "up"
*** NameError: name 'x' is not defined
(Pdb) p y
2
(Pdb) p (lambda: y)()
##### this is more awkward to work around, e.g. (lambda *, y=y: y)()
*** NameError: name 'y' is not defined
Use case: I wan to pass a lambda to a numerical optimizer, but the optimizer fails using the default starting point. Within pdb, I'd like to pass a different starting point but the same lambda, to see whether this helps. |
|
Date |
User |
Action |
Args |
2016-01-10 05:16:24 | Antony.Lee | set | recipients:
+ Antony.Lee |
2016-01-10 05:16:24 | Antony.Lee | set | messageid: <1452402984.12.0.000738362264887.issue26072@psf.upfronthosting.co.za> |
2016-01-10 05:16:23 | Antony.Lee | link | issue26072 messages |
2016-01-10 05:16:22 | Antony.Lee | create | |
|