One I guess annoyance in how my brain handles code refactoring is, as more features get added, previous assumptions go away. I used to only accept PDFs for all modules, then I added sometimes accepting images, so I added a "module_can_accept_images" boolean (via a list I "for in"). Really what I should have done is say "these are the types of files/file extensions this module can accept" and "for in" that list. Definitely one of those hindsight moments. #programming #coding #python
What I'm doing now is, trying to future-proof so I'm keeping track of both the file extension and the mimetype. My feeling is that, the file extension *should* be enough like 99% of the time, right? The other thing I'm doing is calling .lower on every file extension, I feel like that's part of just avoiding annoying bugs.