What is bad with "Relative imports"
Alexander Eisenhuth
newsuser at stacom-software.de
Fri Feb 23 06:33:26 EST 2007
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
More information about the Python-list
mailing list