Hacker News new | past | comments | ask | show | jobs | submit login

If you're not writing your code in a design that lets you run parts of it every few minutes (or more frequently), you're missing out. Best way to avoid bugs in your module: don't put them in there. Find out in the REPL before you put code in the .py file.

Also, it's more important the more data-dependent your code is.




Tests also have the advantage of input automation. They have the disadvantage that you can't poke around at the environment once they're done (unless you drop into a debugger).


I've found this is more and more the primary way I use the Python repl - I invoke pytest and tell it to drop me into the debugger if there's an error.


I usually have a test data set and run my module against it in IPython. So input is automated to some extent. If I'm analyzing the output, it can be helpful to quickly adjust charts and graphs. I'm now in the process of building distribution tests into my test suite, but it's not clear how to track everything. I need data sources essentially kept under version control, but which are generally too big for git.


Python has a lot of REPLs, which one in particular do you mean?


My personal choices are IPython and Jupyter, depending on whether I'm making plots. If you choose Jupyter, though, I caution that you should be careful you don't switch entirely away from modules and test suites. Jupyter can be too easy in a way.


This sounds quite a bit different from the sort of development work I do.

I can see how a REPL would be really useful when working with data, but for building out a webserver or desktop application, it doesn't have nearly as much value.


And tests have less value, or at least are more difficult to write, when you're not sure if an outlier is valuable information or junk to be discarded.




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

Search: