On Sun, Mar 15, 2020 at 9:09 PM Gedare Bloom <ged...@rtems.org> wrote: > > On Sun, Mar 15, 2020 at 5:54 PM Amar Takhar <a...@rtems.org> wrote: > > > > On 2020-03-15 17:26 -0600, Gedare Bloom wrote: > > > > > Make blank lines consistent, 1 or 2, between top-level definitions. (I > > > know, we still haven't settled on a style, but let's aim for > > > consistency.) > > > > Okay. > > > > > > > I think all imports should go at the top? > > > > This is scoped it only runs under certain conditions extremely common in > > Python. > > It's good practice as well as there's no point in loading a module that > > isn't > > used all of the time. Also, it makes for far clearer code as you know the > > module is only used for that snippet. > > > Alright. I think this may need to be specially defined in style guide. > > I believe Google guide makes some restrictions on imports. I'm not > enough Python expert to know, but I really think with the amount of > Python code that is expected to come through, we need to decide on > these things sooner than later. >
I found what I was thinking about: http://google.github.io/styleguide/pyguide.html#313-imports-formatting PEP has similar guidance: https://www.python.org/dev/peps/pep-0008/#imports But there is another problem, which is the restriction not to import specific classes/functions: http://google.github.io/styleguide/pyguide.html#22-imports I'm not sure, but I think that also is violated here. PEP doesn't restrict on this. As usual exceptions can be made for good reasons, which you both have given and is in the current practice in RTEMS python code, but we do need to be aware of these deviations from whatever style guide we end up using as our baseline. The more deviations, the harder it is to check code automatically using tools from other projects. Gedare > > > > Amar. > > _______________________________________________ > > devel mailing list > > devel@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel