WhitakerLab / scona

Code to analyse structural covariance brain networks using python.
https://whitakerlab.github.io/scona/
MIT License
68 stars 33 forks source link

import inside functions #117

Closed wingedRuslan closed 5 years ago

wingedRuslan commented 5 years ago

Hi!

There are a bunch of functions, where import statements are inside the functions' body. Is this made intentionally? Should I refactor and include import only at the top of a module??

Some references: 1) PEP8

Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. 2) StackOverFlow Answer

Module importing is quite fast, but not instant. This means that:

Islast commented 5 years ago

Yes you should always refactor the imports to be at the top of the module

Islast commented 5 years ago

self assigning so that I remember to add this to the development guide

wingedRuslan commented 5 years ago

@Islast What are you planning to add to the guide?

Islast commented 5 years ago

A note that in general imports should go at the top of the file

KirstieJane commented 5 years ago

(This is almost certainly me having no idea what I was doing when I wrote this code! Thank you for doing a much cleaner job @wingedRuslan & @Islast 💖)

Islast commented 5 years ago

Closing since #120 adds this style reccomendation to the documentation