[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/38] qapi: Prefer explicit relative imports
From: |
Beraldo Leal |
Subject: |
Re: [PATCH v2 04/38] qapi: Prefer explicit relative imports |
Date: |
Thu, 24 Sep 2020 19:17:47 -0300 |
On Thu, Sep 24, 2020 at 03:25:50PM -0400, Cleber Rosa wrote:
> On Wed, Sep 23, 2020 at 01:12:09PM -0400, John Snow wrote:
> > On 9/23/20 9:18 AM, Cleber Rosa wrote:
> > > Relative imports are a source of heated debates, but when properly
> > > used in a self contained module like here, they are very posititive
> > > IMO.
> >
> > Still? I know they were loathed pre-3.5, but in my subjective experience
> > they behave the nicest overall in the modern python dialect.
> >
> > What are the downsides?
> >
> > --js
>
> I'll just invite Beraldo to the discussion and let the fun begin :).
Nice try, Cleber! ;)
Well, relative imports are supported by Guido, so I'm not here to say
different. There are some use-cases.
I'm not fully aware of the qapi context and big picture here, but I
guess that depends on how you would like to use your package/scripts.
Some may say that one "downside" is that relative imports are not as
readable as absolute ones. But reading the 04/38 PATH description by
jsnow, yes, looks like using relative imports is one valid option here.
I prefer to use my scripts as packages inside venvs, and I use to have a
setup.py, with absolute imports whenever possible, and when in
development mode, make use of `python3 setup.py develop` which will
create the "links" for me.
--
Beraldo
- Re: [PATCH v2 05/38] qapi: Remove wildcard includes, (continued)
[PATCH v2 08/38] qapi/common.py: Remove python compatibility workaround, John Snow, 2020/09/22
[PATCH v2 17/38] qapi/events.py: add type hint annotations, John Snow, 2020/09/22
[PATCH v2 18/38] qapi/events.py: Move comments into docstrings, John Snow, 2020/09/22