What is bad with "Relative imports"

  • Thread starter Alexander Eisenhuth
  • Start date
A

Alexander Eisenhuth

Hi,

PyLint says that "Relative imports" ... are worth to be warned .

And I ask myself why?

----------------- Example directory structure ---------
Sound/ Top-level package
__init__.py Initialize the sound package
Utils/ Subpackage
__init__.py
iobuffer.py
errors.py
misc.py
...
Formats/

Let's say in misc.py exist the class Player(). What could be bad to expose it in
Utils.__init__() like:

------------------ __init__.py -------------------------
import misc # provoke PyLint warning
Player = misc.Player
....
--------------------------------------------------------

with
Sound.Utils.Player() ??

Thaks for your experience and comments

Regards
Alexander
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top