Chris Nyland wrote at 2021-5-4 22:20 -0400: > ... >So for a while now I have taken to converting >my module, in this example database.py, to the __init__.py of the package. >I remember reading years back that having code in the __init__.py was bad >practice but I can't remember reading for any specific reason.
If your package is not a so called "namespace package" (this is a package components of which are stored in different places and can be installed independent from one another), then I see no reason not to put code into `__init__.py`. When I transform a module into a package, I start by using the former module as the new package's `__init__.py`. Later refactoring steps may move things out into separate modules/subpackages. -- https://mail.python.org/mailman/listinfo/python-list