有胆有识的冰棍 · 韩国漂亮的BJ主播韩宝贝_哔哩哔哩_bili ...· 4 月前 · |
酷酷的冲锋衣 · 如何使用textarea组件_移动开发平台 ...· 5 月前 · |
玉树临风的楼房 · 【Gal周报138期】《君と彼女と彼女の恋。 ...· 6 月前 · |
谈吐大方的木瓜 · 天空、太空、航空和航天_中国航天科技集团· 12 月前 · |
玩手机的鸵鸟 · 无节操摄影部|加岛&远野~纯情组的超甜CUT ...· 1 年前 · |
Message emitted:
Attempted
relative
import
beyond
top-level
package
Description:
Used when a relative import tries to access too many levels in the current package.
Problematic code:
from ................antigravity import NGField # [relative-beyond-top-level]
Correct code:
absolute_import.py
:
from physic.antigravity import NGField
fix_the_relative_import.py
:
# Right number of dots in the import: you needed 15 dots, not 16, duh.
# from ...............antigravity import NGField
Additional details:
Absolute imports were strongly preferred, historically. Relative imports allow you
to reorganize packages without changing any code, but these days refactoring tools and IDEs
allow you to do that at almost no cost anyway if the imports are explicit/absolute.
Therefore, absolute imports are often still preferred over relative ones.
Related links:
Withdraw anti-recommendation of relative imports from documentation
Created by the imports checker.
谈吐大方的木瓜 · 天空、太空、航空和航天_中国航天科技集团 12 月前 |