I am an experienced programmer and know many languages. I am fairly new to python and notebooks
I find my self spending a lot of time debugging my notebooks. What I have noticed is that in a given cell I typically define a function and some additional test code. Often the test code defines some variables. The bug tends to be latter I define a new function f2() that accidentally picks up one of the test variables I previously defined for f1(). So I incorrectly think f2() works. Latter in f3() I wast a ton of time because my assumption that f2() works was never true. What I really wanted to do was pass the accidental global as a function argument
I guess I could write my code as follows to ensure test variables do not escape to the global space
Def f1(a, b):
…
Def f1Test():
A = 1
B = 2
Assert f1(a,b) == xyzzy
ftTest()
Is there a stylistically more pleasing way to avoid these kinds of errors?
Is there some sort of “lint” for notebooks?
Another common bug I typically have are typos in functions. I.E. I miss spell a variable. I like the notebook REPL environment how ever writing lots of test code is a big productivity hit
Kind regards
Andy