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판)
55
1
장
파이썬 데이터 모델
이와는 대조적으로
__str__(
)
메서드는
str(
)
내장 함수가 호출하며
print(
)
함수를 암묵
적으로 사용한다.
__str__(
)
특별 메서드는 최종 사용자에게 보여 주기 적합한 형태의 문자
열을 반환해야 한다.
__str__
(
)
메서드를 꼭 구현해야 하는 것은 아니다.
__str__
(
)
을 구현하지 않으면
__
repr__
(
)
이 대신 호출되는데,
__repr__
(
)
메서드가 출력하는 메시지가 나쁘지 않을 때도
종종 있다. 이 책에서
__str__(
)
메서드를 구현하는 예제가 몇 개 있는데, 그중 하나가 [예제
5
-
2
]다.
TIP
toString()
메서드를 제공하는 언어를 사용해 본 프로그래머들은
__str__()
은 구현하면서
__
repr__()
은 구현하지 않을 때가 있다. 파이썬에서 이 두 특별 메서드 중 하나만 구현해야 한다면
__
repr__()
메서드를 구현하라.
스택 오버플로의 질문 스레드(
https://fpy.li/1-5
)에서는
__str__()
과
__repr__()
의 차이점에 관한
알렉스 마르텔리
Alex
Martelli
와 마르틴 피터스
Martijn
Pieters
의 훌륭한 답변을 볼 수 있다.
1
.
3
.
3
사용자 정의형의 불리언값
파이썬에도
bool
형은 있지만,
if
문이나
while
문의 흐름을 제어하는 ...
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