3 ms·
Long, self-documenting variable names. Because someone else will eventually have to debug or rework your code. And that might even be you, six months from now
by joezydeco 5y ago
Long, self-documenting variable names.
Because someone else will eventually have to debug or rework your code. And that might even be you, six months from now after you've forgotten everything.
It's relatively cheap and cross platform compatible.
- d4rkp4ttern 5y agoA version of this is extremely useful in Deep Learning code, where a lot of time is spent trying to guess the shape and dims of tensor variables. To help with this I often name variables like inputs_b_t_f where b = batches, t = time steps, f = features. This combined with something like einops [1] ( intuitive reshaping library) can be a huge time saver. [1] https://github.com/arogozhnikov/einops https://github.com/arogozhnikov/einops
- swagasaurus-rex 5y agoIts also easier to search through a codebase for unique and specific variable names.
- sam_bristow 5y agoThe length of a variable name so old be proportionate to the scope. Global scope? long descriptive name. Loop variable? 'i' or 'j' is fine.