2 ms·
I refactored some Python junior developer code recently. Non standard style (there is a PEP for that) and not consistently non standard. Obfuscated variable n
by pmontra 9y ago
I refactored some Python junior developer code recently.
Non standard style (there is a PEP for that) and not consistently non standard.
Obfuscated variable names.
A for loop over a list with ifs on most of the indices.
A sequential scan with remote API calls instead of a binary search.
My favorite is a get_info function returning an object of class Info with a couple of string attributes. Digging into it, the function looked for the CSRF token in a HTML page. I renamed it get_csrf_token, made it return one string, deleted the class.
However the code did work and I'm sure I did those things or worse when I was young.