RFC: Relative Imports vs Absolute Imports #3525
Replies: 7 comments 1 reply
-
|
My preference is always for absolute imports, as they make the code clear to read. I understand that relative imports can help in the development process while setting up a development environment, but, if possible, I would go with absolute imports. In case it is not a pain and do not breaks what we have now, I agree with removing the relative imports. |
Beta Was this translation helpful? Give feedback.
-
|
+1 for absolute imports between sub-packages, nor +1 or -1 for absolute imports between modules of the same sub-package, as the use cases for relative imports there are stronger. |
Beta Was this translation helpful? Give feedback.
-
|
@apahim can you elaborate on the "relative imports there are stronger", please? |
Beta Was this translation helpful? Give feedback.
-
|
https://www.python.org/dev/peps/pep-0328/#rationale-for-relative-imports |
Beta Was this translation helpful? Give feedback.
-
|
But as I said, nor +1 or -1. If you change it, awesome, if you don't, fine :) |
Beta Was this translation helpful? Give feedback.
-
|
Haa ok, thanks! |
Beta Was this translation helpful? Give feedback.
-
|
@clebergnu are you ok with moving from relative to absolute ? I would like to remove the |
Beta Was this translation helpful? Give feedback.
{{title}}
-
Hi all,
I noticed that we have some selftests that checks for absolute imports on core (
selftests/modules-boundaries.sh).From PEP8:
I just would like to know what you think about that. What do you prefer and why?
Does anyone have any strong objections to removing relative imports?
Beta Was this translation helpful? Give feedback.
All reactions