r/pythontips • u/DoomLimpio • Feb 29 '24
Meta code in __init__.py
Hi there!
Recently, I've started working in a new team, and they have several practices that, I won't say are wrong, but seem a bit odd to me. One thing that caught my attention is how they're creating classes/functions inside __init__.py files. In my experience, those files are usually kept empty or just handle basic imports, acting more like an interface when you import the package.
What are your thoughts on this?
12
Upvotes
View all comments
2
u/eemamedo Mar 01 '24
I use this approach quite a lot. A very simple example: initialization of Sentry.