Good coding practices
I’m a strong believer of using good coding practices and will advocate for it wherever and whenever I can. Be it in code reviews, community of practice sessions, mentoring etc.
It is commonly known in Python not to use
import *. If you want to know why, read this. It makes me flinch every time I see the usage of that in Python code I lay my eyes on.
What’s out there in Python-land keeps amazing me. Today I learned about a Python module called RemoveStar. It scans a file, directory or module, and points out usages of
import *. Or of you like, it will auto replace with proper imports.
Luckily all usages of
import * have been eradicated in our code bases; or so I thought…
I tried the RemoveStar tool on one of our repositories. Lo and behold, 3 instances of
import * where found. For now, rather than refactoring the code, I will have a chat with the team what I found.
Have a good weekend!
This post is part of a series of articles about “What I Have Learned Today”; acknowledging every day the thing I have learned. Feel free to read the other posts. all opinions in this article are my own and not necessarily represent the views of my employer.