일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Python Implementation
- t1
- Class
- 109. Convert Sorted List to Binary Search Tree
- 30. Substring with Concatenation of All Words
- 파이썬
- 프로그래머스
- 315. Count of Smaller Numbers After Self
- Decorator
- Regular Expression
- LeetCode
- 밴픽
- kaggle
- Substring with Concatenation of All Words
- Python Code
- Python
- Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- 43. Multiply Strings
- attribute
- 운영체제
- Generator
- concurrency
- Protocol
- data science
- DWG
- 715. Range Module
- 시바견
- iterator
- shiba
Archives
- Today
- Total
목록Property (1)
Scribbling
Python: Dynamic attributes and properties (동적 속성과 프로퍼티)
파이썬에서는 데이터 속성과 메서드를 통틀어 속성이라고 한다. 메서드는 단지 호출가능한 속성이다. 프로퍼티를 사용하면 클래스인터페이스를 변경하지 않고도 공개 데이터 속성을 접근자 메서드(getter & setter)로 대체할 수 있다. 파이썬 인터프리터는 obj.attr과 같은 점 표기법으로 표현되는 속성에 대한 접근을 __getattr__()과 __setattr__() 등 특별 메서드를 호출하여 평가한다. 사용자 정의 클래스는 __getattr__() 메서드를 오버라이드하여 '가상 속성'을 구현할 수 있다. 1. 동적 속성을 이용한 데이터 랭글링 다음과 같은 json data를 랭글링 하는 예제를 살펴보자. { "Schedule": { "conferences": [{"serial": 115 }], "ev..
Computer Science/Python
2022. 6. 17. 14:53