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판)
1017
24
장
클래스 메타프로그래밍
__setattr__(
)
을 구현할 가치가 있는지는 논란의 여지가 있다. 이 메서드가 없으면
movie.
director = ‘Greta Gerwig’
문장이 성공하지만,
director
속성은 어떤 방법으로도 검사되
지 않고, [예제
24
-
6
]에서 구현한
__repr__(
)
에도 나오지 않고,
_asdict(
)
가 반환한
dict
에도 포함되지 않을 것이다.
record_factory.py
(
예제
24
-
2
)
에서는 이 문제를
__slots__
클래스 속성을 이용해 해결했
다. 그러나 다음 절에서 설명하듯이 이 경우에는 이 방법을 사용하지 못한다.
24
.
5
.
1
_ _
init
_
subclass
_ _( )가 _ _
slots
_ _를 설정하지 못하는 이유
__slots__
속성은
type.__new__(
)
에 전달된 클래스 네임스페이스 안의 항목에 들어갈 때만
유효하다. 기존 클래스에
__slots__
속성을 추가하는 것은 효과가 없다. 파이썬은 클래스가
생성된 후에야
__init_subclass__(
)
를 호출하기 때문에, 이때는
__slots__
를 설정하기에
이미 늦었다. 클래스 데커레이터도
__slots__
를 설정할 수 없다. 클래스 데커레이터는 심지어
__init_subclass__(
)
가 호출된 후에 적용되기 때문이다. 시점에 관련된 문제는
24
.
7
절 ‘임
포트 타임과 런타임 비교’에서 다룬다.
런타임에
__slots__
를 설정하려면
type.__new__(
)
의 마지막 인수로 전달되는 클래스 네임
스페이스를 ...
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