1

I am making a Django project with multiple apps and was wondering if it would be considered good or bad practice to create a single library.py file with all the "import x" and "from x import y, z" statements and then simply put "from library.py import *" at the top of every other file?

What would be considered best practice for managing your imported libraries like this?

Thanks for the help.

  • You should **never** use `from X import *`. Imagine `X` exposing a function called `min` (or anything else that clashes with built-in names or even names defined in your importing script) – DeepSpace Mar 15 '21 at 12:58

1 Answers1

1

From the zen of Python: 'Explicit is better than implicit'. So it would be better to explicitly import everything. This makes debugging for example more clear.

See for more details about importing the discussion here

Jan Willem
  • 820
  • 1
  • 6
  • 24