What is bad with "Relative imports"

Discussion in 'Python' started by Alexander Eisenhuth, Feb 23, 2007.

  1. 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
     
    Alexander Eisenhuth, Feb 23, 2007
    #1
    1. Advertisements

  2. Alexander Eisenhuth

    Aahz Guest

    Aahz, Feb 28, 2007
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.