Skip to Content
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
For Enterprise
For Government
For Higher Ed
For Individuals
For Marketing
Explore Skills
Cloud Computing
Microsoft Azure
Amazon Web Services (AWS)
Google Cloud
Cloud Migration
Cloud Deployment
Cloud Platforms
Data Engineering
Data Warehouse
SQL
Apache Spark
Microsoft SQL Server
MySQL
Kafka
Data Lake
Streaming & Messaging
NoSQL Databases
Relational Databases
Data Science
Pandas
R
MATLAB
SAS
D3
Power BI
Tableau
Statistics
Exploratory Data Analysis
Data Visualization
AI & ML
Generative AI
Machine Learning
Artificial Intelligence (AI)
Deep Learning
Reinforcement Learning
Natural Language Processing
TensorFlow
Scikit-Learn
Hyperparameter Tuning
MLOps
Programming Languages
Java
JavaScript
Spring
Python
Go
C#
C++
C
Swift
Rust
Functional Programming
Software Architecture
Object-Oriented
Distributed Systems
Domain-Driven Design
Architectural Patterns
IT/Ops
Kubernetes
Docker
GitHub
Terraform
Continuous Delivery
Continuous Integration
Database Administration
Computer Networking
Operating Systems
IT Certifications
Security
Network Security
Application Security
Incident Response
Zero Trust Model
Disaster Recovery
Penetration Testing / Ethical Hacking
Governance
Malware
Security Architecture
Security Engineering
Security Certifications
Design
Web Design
Graphic Design
Interaction Design
Film & Video
User Experience (UX)
Design Process
Design Tools
Business
Agile
Project Management
Product Management
Marketing
Human Resources
Finance
Team Management
Business Strategy
Digital Transformation
Organizational Leadership
Soft Skills
Professional Communication
Emotional Intelligence
Presentation Skills
Innovation
Critical Thinking
Public Speaking
Collaboration
Personal Productivity
Confidence / Motivation
Features
All features
Verifiable skills
AI Academy
Courses
Certifications
Interactive learning
Live events
Superstreams
Answers
Insights reporting
Radar Blog
Buy Courses
Plans
Sign In
Try Now
O'Reilly Platform
book
전문가를 위한 파이썬(2판)
by
루시아누 하말류
,
강권학
November 2024
Beginner to intermediate
1064 pages
25h 21m
Korean
Hanbit Media, Inc.
Content preview from
전문가를 위한 파이썬(2판)
1009
24
장
클래스 메타프로그래밍
자료형 힌트에 사용되는
type
을 [예제
24
-
2
]에서 처음으로 보았다. 어노테이션이 단순히
->
type
이라면
record_factory(
)
가 클래스를 반환함을 의미하는데, 이것도 맞기는 하다. 그러
나
-> type[tuple]
로 어노테이트하는 것이 더 정확하다. 반환된 클래스가
tuple
의 서브클래
스임을 의미하기 때문이다.
[예제
24
-
2
]
record_factory(
)
의 마지막 행은
cls_name
값을 이름으로 사용하고,
object
를 단 하나의 직속 슈퍼클래스로 사용하며, 네임스페이스에
__slots__
,
__init__
,
__
iter__
,
__repr__
이 들어 있는 클래스를 생성한다. 이 중 마지막 세 개
__init__
,
__iter__
,
__repr__
은 인스턴스 메서드다.
__slots__
클래스 속성에 다른 이름을 붙일 수도 있었지만, 그러면 할당할 속성명을 검증하기
위해
__setattr__
(
)
메서드를 구현해야 한다. 레코드와 같은 구조의 클래스에서 속성들의
이름이 언제나 동일하고 같은 순서로 유지되기를 원하기 때문이다. 그러나
__slots__
를 사용
하면 수백만 객체를 사용할 때 메모리를 절약하는 장점도 있지만,
11
.
11
절 ‘
__slots__
로 메모
리 절약하기’에서 설명한 단점도 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial
You might also like
전문가를 위한 리액트
테자스 쿠마르
데이터로 전문가처럼 말하기
칼 올친
개발자를 위한 머신러닝&딥러닝
로런스 모로니
고성능 파이썬(2판)
오현석, 미샤 고렐릭, 이안 오스발트
Publisher Resources
ISBN: 9791169211772