- Every Python function should return a value if it supposed to return a value. You should explicit return None. (Explicit is better than implicit - PEP 20)
"So if a function is supposed to return a value, then I make sure all code paths have a return, and that the return has a value, even if it is None.
If a function "doesn't" return a value, that is, if it is never called by someone using its return value, then it's ok to end without a return, and if I need to return early, I use the bare form,
- pdb not work on multithreading
- careful with copy. Understand when you need deepcopy
- You should know how to use debuger, it will save your life one day.
- Debugger and unittest will show it value when you found your bug. When you fail!
Wednesday, July 25, 2012
Code then fail...
Lesson for to day: (some best practice i've leart from my experiences)