How to write reusable (but not usable) code¶
Python is an easy and powerful language for machine learning practitioner like me. A good style makes the code easy to read and reuse. A lengthy one comes from Google. Here, I want to share with you some tips to create troubles when others want to use your code.
Actually, I want you to avoid them.
To keep things tight, a short list followed by detailed examples in below.
- Write out-dated (and misleading) comment
- Mix controllable parameter and hard-coded parameters
- Save parameters in configuration file and never share it
- Access variables, functions, classes via string in the name of dynamic
- Give the same name to similar (but different) functions
- Mis-spell function name
Read more…