반응형
    
    
    
  Module
- 함수나 변수, 클래스 등을 가진 파일(.py)
 - 모듈 안에는 함수, 클래스 또는 변수들이 정의되어 있음
 - 파이썬은 많은 표준 라이브러리 모듈을 제공
 
Package

- 모듈을 효율적으로 관리하기 위한 모듈의 상위 개념
 - 공동 작업이나 코드의 유지 보수 등에 유리
 
import 패키지.모듈
import 패키지.모듈.변수
import 패키지.모듈.함수
import 패키지.모듈.클래스
from 패키지.모듈 import 변수/함수/클래스
Google Python Style Guide
google.github.io/styleguide/pyguide.html
styleguide
Style guides for Google-originated open-source projects
google.github.io
Imports
- Use import statements for packages and modules only, not for individual classes or functions
 - import x
- importing packages and modules
 
 - from x import y
- where x is the package prefix and y is the module name with no prefix
 
 - from x import y as z
- if two modules named y are to be imported or if y is an inconveniently long name
 
 - import y as z
- only when z is standard abbreviation (ex. np for numpy)
 
 
Packages
import each module using the full pathname location of the module
728x90
    
    
  반응형
    
    
    
  'Python > Python 기초' 카테고리의 다른 글
| Dynamic Typing vs Static Typing (0) | 2022.04.26 | 
|---|---|
| Object Reference (0) | 2021.02.25 | 
| [Python] Python Built-in Functions (0) | 2021.02.24 | 
| [Python] Python Exception Handling (0) | 2021.02.24 | 
| [Python] Python Class (0) | 2021.02.23 |