recedence - file vs package
아래와 같은 상황에서 우선순위는?
1. file named bar
/foo/bar.py
2. package named bar
/foo/bar/__init__.py
3. directory named bar
/foo/bar
// which of the 3 will below line import?
from foo import bar
정답은 2. package, 1. file, 3. directory 순서다.
init파일이 없는 directory도 package와 크게 다를 바 없지만 이 경우 우선순위에서 차이가 난다.
더 자세하게 알고싶다면 PEP 420을 읽어보자.
출처: https://stackoverflow.com/a/64738456
Author And Source
이 문제에 관하여(recedence - file vs package), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@yoonkangho/precedence-file-vs-package저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)