Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use debuggers as ways of inserting print statements into the code, without knowing what exactly I want to print before running it.

So, it goes something like this:

1. Insert `import pdb; pdb.set_trace()` into the code where I think there's an issue.

2. `print foo`

3. Hmm, that doesn't seem right... `print baz(foo)`

4. Ah, I needed to change... tabs over to editor

This style is heavily influenced by the fact that I primarily program in Python and Ruby, where one generally learns the language by typing commands into a REPL, rather than executing a file. When working on a Python project with a bunch of classmates who were good programmers, but used to Java and C++, I found that they found this approach utterly unintuitive.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: