Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Better ways to name your utils module (moderndescartes.com)
3 points by the_bookmaker on Sept 12, 2023 | hide | past | favorite | 2 comments


utils.py is better than the alternative of every module reimplementing some common utility, or importing an otherwise unneeded module because that's where said common utility was first implemented. The fact that there's util.py in the first place is a good thing. Now, if it gets big and disparate enough then having foo_utils.py and bar_utils.py might be even better (but maybe they should be in their own subpackages instead, i.e. foo/utils.py and bar/utils.py?), but that doesn't make utils.py bad.


I like to see core.py more than any of those. Things accumulate in util.py because you can’t find them in the standard library. (Right?) So don’t diminish them as misc or helpers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: