Closed OverLordGoldDragon closed 4 years ago
I think this is an idea worth exploring. @impact27, what do you think about it?
Something like https://github.com/spyder-ide/spyder/pull/10542? I really like this PR :) I use it to load matplotlib and numpy in every frame I debug.
That's it! Sorry Quentin for not reviewing that one (I forgot about it). I'll merge it for sure for 4.2.0.
@impact27 Sure looks like it, I look forward to it. My function of interest spares much typing in pretty-printing object attributes / lists:
def iprint(iterable):
"""Print iterable in a column"""
if isinstance(iterable, dict):
for k, v in iterable.items():
print(k, '--', v)
else:
for x in iterable:
print(x)
iprint(vars(obj))
iprint(dir(obj))
@OverLordGoldDragon Do you know the Pbd pp
command? https://docs.python.org/3/library/pdb.html#pdbcommand-pp . This might get you a similar result
@impact27 Nice - this does the trick. Your PR's still worth pursuing though.
Is it possible to set one? I have functions useful for debugging that I placed in
Preferences > IPython console > Startup > Run a file
, but they're are undefined inipdb>
. Further, running debugger appears to undo the startup script; I can access functions before running debugger, but not after (unless I restart kernel).I figure this isn't as simple due to debugger namespace scoping, so I suppose the question's rather whether there's a way to define global functions - but that IPython "forgets" the startup script after debugging remains unclear to me.