question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python variables obscur ipdb commands

See original GitHub issue

This PR: #https://github.com/ipython/ipython/pull/9449 introduced annoying problem: I couldn’t step through the following code (execute line 3):

n = 1
next = 1
print('end')

Because n/next commands weren’t working:

$ ipdb test.py
> /tmp/test.py(1)<module>()
----> 1 n = 1
      2 next = 1
      3 print('end')

ipdb> next
> /tmp/test.py(2)<module>()
      1 n = 1
----> 2 next = 1
      3 print('end')

ipdb> next
> /tmp/test.py(3)<module>()
      1 n = 1
      2 next = 1
----> 3 print('end')

ipdb> next
1
ipdb> n
1
ipdb> !n
1
ipdb> !next
1

I discovered that in this case I can use standard pdb or I can get it to work in ipdb by using !!n (it still has a bug that @tcztzy tried to solve in https://github.com/ipython/ipython/pull/10035) but what do you think about changing this behavior: all ipdb builtin commands should work as they meant to and if we want to see python variables we use i.e.: !n instead of n. Variables’ names that are not ipdb commands could still be displayed by just writing their name.

StackOverflow thread

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:13
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
takluyvercommented, Nov 9, 2016

#10050 reverts it. As the voting is currently 11-1 for reverting, I haven’t made it configurable at present - every config option adds complexity and potential bugs, so I’m reluctant to add them without a certain level of support.

We could also look at providing options to plug in externally developed debuggers - I don’t think our debugger is particularly great, and there are projects like pudb out there which have spent much more time than us on debugger UI.

0reactions
fperezcommented, Dec 20, 2016

Late to the party, but I wanted to say that I strongly support the reversion. Over and over we’ve encountered that customizations that try to be overly smart, even though well-intentioned, typically cause more confusion than they are worth. Over the years we’ve backed off on a number of those (made them optional when it’s easy to do in a simple way), and I think this falls in that category.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ipdb commands obscured by variables - python
I installed python3-ipdb on my linux machine and it worked there also. next was always treated as a command and !next showed the...
Read more >
Python Ipdb Cheatsheet - Chuan Wang's Website
With a function name, set a break at the first executable line of that function. Without argument, list all breaks. Each breakpoint is...
Read more >
What Python debugger do you use?
All IDEs have debuggers, ie stepping through code and looking at variable values. So just say: I use my IDEs debugger and you've...
Read more >
Python Scripting - The LLDB Debugger - LLVM
The breakpoint commands will use the global path Python variable that we got from our DFS ... It automatically gives the function an...
Read more >
Python Debug Cheatsheet - Peter Xie - Medium
ipdb is an enhanced version of pdb (built-in). It supports all pdb commands and is simply easier to use like tab for auto-complete....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found